Class: Otaku::Handler
- Inherits:
-
Object
- Object
- Otaku::Handler
- Defined in:
- lib/otaku/handler.rb
Defined Under Namespace
Classes: MagicProc
Instance Method Summary collapse
- #[](data) ⇒ Object
-
#initialize(context, handler) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(context, handler) ⇒ Handler
Returns a new instance of Handler.
4 5 6 7 |
# File 'lib/otaku/handler.rb', line 4 def initialize(context, handler) @context = __context_as_code__(context) @proc = __proc_as_code__(handler) end |
Instance Method Details
#[](data) ⇒ Object
9 10 11 |
# File 'lib/otaku/handler.rb', line 9 def [](data) eval(@context).instance_exec(data, &eval(@proc)) end |