lib/convenient_service/utils/string/split.rb in convenient_service-0.9.0 vs lib/convenient_service/utils/string/split.rb in convenient_service-0.10.0
- old
+ new
@@ -4,37 +4,37 @@
module Utils
module String
class Split < Support::Command
##
# @!attribute [r] string
- # @return [#to_s]
+ # @return [String]
#
attr_reader :string
##
# @!attribute [r] delimiters
# @return [Array<String>]
#
attr_reader :delimiters
##
- # @param string [Symbol, String]
+ # @param string [#to_s]
# @param delimiters [Array<String>]
# @return [void]
#
def initialize(string, *delimiters)
- @string = string
+ @string = string.to_s
@delimiters = delimiters
end
##
# @return [String]
#
# @internal
# https://stackoverflow.com/a/51380514/12201472
#
def call
- string.to_s.split(::Regexp.union(delimiters))
+ string.split(::Regexp.union(delimiters))
end
end
end
end
end