Class: Stacko::MethodMap
- Inherits:
-
Object
- Object
- Stacko::MethodMap
- Defined in:
- lib/stacko/method_map.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(map = {}) ⇒ MethodMap
constructor
A new instance of MethodMap.
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 |