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:



29
30
31
32
# File 'lib/convenient_service/utils/string/split.rb', line 29

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

Instance Attribute Details

#delimitersObject (readonly)

Returns the value of attribute delimiters.



22
23
24
# File 'lib/convenient_service/utils/string/split.rb', line 22

def delimiters
  @delimiters
end

#stringObject (readonly)

Returns the value of attribute string.



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

def string
  @string
end

Instance Method Details

#callString

Returns:



40
41
42
# File 'lib/convenient_service/utils/string/split.rb', line 40

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