Sha256: a548860e3e435fd17ddc2346231b03d53388e7f59b42c561399e0f862cc0bc27

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 Bytes

Contents

require 'strscan'

class Usher
  class Splitter
    
    def self.for_delimiters(router, valid_regex)
      SplitterInstance.new(Regexp.new("[#{router.delimiters.collect{|d| Regexp.quote(d)}}]|[^#{router.delimiters.collect{|d| Regexp.quote(d)}}]+"))
    end

    class SplitterInstance
    
      def initialize(url_split_regex)
        @url_split_regex = url_split_regex
      end
      
      def url_split(path)
        path.scan(@url_split_regex)
      end
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joshbuddy-usher-0.4.10 lib/usher/splitter.rb
joshbuddy-usher-0.4.11 lib/usher/splitter.rb