Class: Flirt::Callback

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Callback

Returns a new instance of Callback.



10
11
12
13
# File 'lib/flirt/callback.rb', line 10

def initialize(opts = {})
    self.callback_name = opts.fetch(:callback_name)
    self.object        = opts.fetch(:object)
end

Instance Attribute Details

#callback_nameObject

Returns the value of attribute callback_name.



8
9
10
# File 'lib/flirt/callback.rb', line 8

def callback_name
  @callback_name
end

#objectObject

Returns the value of attribute object.



8
9
10
# File 'lib/flirt/callback.rb', line 8

def object
  @object
end

Instance Method Details

#==(other_callback) ⇒ Object



21
22
23
# File 'lib/flirt/callback.rb', line 21

def ==(other_callback)
    object == other_callback.object && callback_name == other_callback.callback_name
end

#call(event_data) ⇒ Object



16
17
18
# File 'lib/flirt/callback.rb', line 16

def call(event_data)
    object.send callback_name, event_data
end