Class: Shackleton::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/shackleton/mapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Mapper



4
5
6
# File 'lib/shackleton/mapper.rb', line 4

def initialize &block
  @root = Shackleton::Route.new(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **kwargs, &block) ⇒ Object



8
9
10
11
# File 'lib/shackleton/mapper.rb', line 8

def method_missing(method, *args, **kwargs, &block)
  return Shackleton::Builder.new.add_route(@root[method.to_sym], kwargs) if @root[method.to_sym]
  super
end