Class: Otaku::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/otaku/handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(handler) ⇒ Handler

Returns a new instance of Handler.



4
5
6
# File 'lib/otaku/handler.rb', line 4

def initialize(handler)
  @proc = SerializableProc.new(&handler)
end

Instance Method Details

#marshal_dumpObject



16
17
18
# File 'lib/otaku/handler.rb', line 16

def marshal_dump
  @proc
end

#marshal_load(data) ⇒ Object



20
21
22
# File 'lib/otaku/handler.rb', line 20

def marshal_load(data)
  @proc = data
end

#process(data) ⇒ Object



8
9
10
# File 'lib/otaku/handler.rb', line 8

def process(data)
  @proc.call(data)
end

#rootObject



12
13
14
# File 'lib/otaku/handler.rb', line 12

def root
  @proc.file
end