Class: Stacko::MethodMap

Inherits:
Object
  • Object
show all
Defined in:
lib/stacko/method_map.rb

Instance Method Summary collapse

Constructor Details

#initialize(map = {}) ⇒ MethodMap

Returns a new instance of MethodMap.



3
4
5
# File 'lib/stacko/method_map.rb', line 3

def initialize(map = {})
  @map = map
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
# File 'lib/stacko/method_map.rb', line 7

def call(env)
  meth = env['METHOD_NAME']
  raise(::Stacko::NoMethodError) unless @map.key?(meth)
  @map[meth].call(env)
end