Class: ApiMapper::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/api_mapper/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, path, mapper) ⇒ Route

Returns a new instance of Route.



33
34
35
36
37
# File 'lib/api_mapper/router.rb', line 33

def initialize(method, path, mapper)
  @method = method
  @path = Addressable::Template.new(path)
  @mapper = mapper
end

Instance Attribute Details

#mapperObject (readonly)

Returns the value of attribute mapper.



31
32
33
# File 'lib/api_mapper/router.rb', line 31

def mapper
  @mapper
end

Instance Method Details

#match(method, path) ⇒ Object



39
40
41
# File 'lib/api_mapper/router.rb', line 39

def match(method, path)
  @method == method && @path.match(path)
end