Class: Otaku::Handler
- Inherits:
-
Object
- Object
- Otaku::Handler
- Defined in:
- lib/otaku/handler.rb,
lib/otaku/handler/context.rb,
lib/otaku/handler/processor.rb,
lib/otaku/handler/magic_proc.rb
Defined Under Namespace
Classes: Context, MagicProc, Processor
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
Instance Method Summary collapse
-
#initialize(context, handler) ⇒ Handler
constructor
A new instance of Handler.
- #marshal_dump ⇒ Object
- #marshal_load(data) ⇒ Object
- #process(data) ⇒ Object
- #root ⇒ Object
Constructor Details
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/otaku/handler.rb', line 8 def context @context end |
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
8 9 10 |
# File 'lib/otaku/handler.rb', line 8 def processor @processor end |
Instance Method Details
#marshal_dump ⇒ Object
23 24 25 |
# File 'lib/otaku/handler.rb', line 23 def marshal_dump [@context, @processor] end |
#marshal_load(data) ⇒ Object
27 28 29 |
# File 'lib/otaku/handler.rb', line 27 def marshal_load(data) @context, @processor = data end |
#process(data) ⇒ Object
15 16 17 |
# File 'lib/otaku/handler.rb', line 15 def process(data) @context.eval!.instance_exec(data, &@processor.eval!) end |
#root ⇒ Object
19 20 21 |
# File 'lib/otaku/handler.rb', line 19 def root File.dirname(@processor.file) end |