Sha256: 8c757684874087a26882c57ba8c16959c4634de9a52974916b68bea4cfbd0d25

Contents?: true

Size: 813 Bytes

Versions: 5

Compression:

Stored size: 813 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'route/path'
require 'route/splitter'
require 'route/variable'
require 'route/http'

class Usher
  class Route
    attr_reader :paths, :original_path, :requirements, :conditions, :params, :primary_path
    
    def initialize(original_path, router, options = {})
      @original_path = original_path
      @router = router
      @requirements = options.delete(:requirements)
      @conditions = options.delete(:conditions)
      @transformers = options.delete(:transformers)
      @paths = Splitter.new(@original_path, @requirements, @transformers).paths.collect {|path| Path.new(self, path)}
      @primary_path = @paths.first
    end

    def to(options)
      @params = options
      self
    end

    def name(name)
      @router.name(name, self)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
joshbuddy-usher-0.0.3 lib/usher/route.rb
joshbuddy-usher-0.1.0 lib/usher/route.rb
joshbuddy-usher-0.1.1 lib/usher/route.rb
joshbuddy-usher-0.1.2 lib/usher/route.rb
joshbuddy-usher-0.2.0 lib/usher/route.rb