Sha256: 6d5c182d526ea46296d7ccc43ca1203a880fa8bf655395f75e8f2d35e1679965
Contents?: true
Size: 863 Bytes
Versions: 5
Compression:
Stored size: 863 Bytes
Contents
# frozen_string_literal: true module ConvenientService module Utils module String class Split < Support::Command ## # @!attribute [r] string # @return [#to_s] # attr_reader :string ## # @!attribute [r] delimiters # @return [Array<String>] # attr_reader :delimiters ## # @param string [Symbol, String] # @param delimiters [Array<String>] # @return [void] # def initialize(string, *delimiters) @string = string @delimiters = delimiters end ## # @return [String] # # @internal # https://stackoverflow.com/a/51380514/12201472 # def call string.to_s.split(::Regexp.union(delimiters)) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems