mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 12:16:06 +08:00
15 lines
371 B
Ruby
15 lines
371 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module RepositoryImportParser
|
||
|
module Util
|
||
|
def self.split_by_delimiter(text:, delimiter:)
|
||
|
# If pattern is a single space, str is split on whitespace, with leading whitespace, new lines, etc...
|
||
|
if delimiter == ' '
|
||
|
text.split(/ /).reject(&:empty?)
|
||
|
else
|
||
|
text.split(delimiter)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|