Class: Usher::Splitter::SingleCharacterSplitterInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/usher/splitter.rb

Instance Method Summary collapse

Constructor Details

#initialize(delimiters) ⇒ SingleCharacterSplitterInstance

Returns a new instance of SingleCharacterSplitterInstance.



13
14
15
# File 'lib/usher/splitter.rb', line 13

def initialize(delimiters)
  @url_split_regex = Regexp.new("[#{delimiters.collect{|d| Regexp.quote(d)}.join}]|[^#{delimiters.collect{|d| Regexp.quote(d)}.join}]+")
end

Instance Method Details

#url_split(path) ⇒ Object Also known as: split



17
18
19
# File 'lib/usher/splitter.rb', line 17

def url_split(path)
  path.scan(@url_split_regex)
end