lib/usher/splitter.rb in usher-0.6.2 vs lib/usher/splitter.rb in usher-0.6.3
- old
+ new
@@ -12,27 +12,25 @@
def initialize(delimiters)
@url_split_regex = Regexp.new("[#{delimiters.collect{|d| Regexp.quote(d)}.join}]|[^#{delimiters.collect{|d| Regexp.quote(d)}.join}]+")
end
- def url_split(path)
+ def split(path)
path.scan(@url_split_regex)
end
- alias split url_split
end
class MultiCharacterSplitterInstance
def initialize(delimiters)
@delimiters = delimiters
end
- def url_split(path)
+ def split(path)
split_path = path.split(delimiters_regexp)
- split_path.reject!{|s| s.size.zero? }
+ split_path.reject!{|s| s.empty? }
split_path
end
- alias split url_split
protected
def delimiters_regexp
Regexp.new("(#{@delimiters.unescaped.collect{|d| Regexp.quote(d)}.join('|')})")
\ No newline at end of file