Class: Usher::Splitter::SingleCharacterSplitterInstance
- Inherits:
-
Object
- Object
- Usher::Splitter::SingleCharacterSplitterInstance
- Defined in:
- lib/usher/splitter.rb
Instance Method Summary collapse
-
#initialize(delimiters) ⇒ SingleCharacterSplitterInstance
constructor
A new instance of SingleCharacterSplitterInstance.
- #url_split(path) ⇒ Object (also: #split)
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 |