Sha256: 6f81e9d9e07d58571e9f74fcb850f230bcc0ee6511d79c08c977f978369d19e9

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'route/path'
require 'route/splitter'
require 'route/separator'
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

1 entries across 1 versions & 1 rubygems

Version Path
joshbuddy-usher-0.0.2 lib/usher/route.rb