Class: ConvenientService::Utils::String::Split

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/string/split.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(string, *delimiters) ⇒ void

Parameters:



24
25
26
27
# File 'lib/convenient_service/utils/string/split.rb', line 24

def initialize(string, *delimiters)
  @string = string.to_s
  @delimiters = delimiters
end

Instance Attribute Details

#delimitersObject (readonly)

Returns the value of attribute delimiters.



17
18
19
# File 'lib/convenient_service/utils/string/split.rb', line 17

def delimiters
  @delimiters
end

#stringObject (readonly)

Returns the value of attribute string.



11
12
13
# File 'lib/convenient_service/utils/string/split.rb', line 11

def string
  @string
end

Instance Method Details

#callString

Returns:



35
36
37
# File 'lib/convenient_service/utils/string/split.rb', line 35

def call
  string.split(::Regexp.union(delimiters))
end