Sha256: a49b1c40e133eac2fb136fd73c8d2d13ef34fe6be8e4f67ed0e0749cb151278d
Contents?: true
Size: 543 Bytes
Versions: 6
Compression:
Stored size: 543 Bytes
Contents
module Signal class Listener def initialize(context, type, event, &block) @context = context @type = type @event = event @block = block @event_method = :"#{@type}_#{@event}" end def method_missing(method_name, *args) return super unless respond_to_missing?(method_name, false) @block.call(*args) end def to_s "<#{self.class} event: #{@event_method}>" end def respond_to_missing?(method_name, include_private) method_name == @event_method end end end
Version data entries
6 entries across 6 versions & 1 rubygems