Class: SimpleLayout::EventHandlerProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(host, evt, &block) ⇒ EventHandlerProxy

Returns a new instance of EventHandlerProxy.



8
9
10
11
12
# File 'lib/simple_layout.rb', line 8

def initialize(host, evt, &block)
  @host = host
  @evt = evt
  self << block if block
end

Instance Method Details

#<<(v) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/simple_layout.rb', line 13

def <<(v)
  if v && v.respond_to?('call')
    @host.signal_connect(@evt) do |*args|
      v.call(*args)
    end
  end
  self
end