class Flirt::Callback
Attributes
callback_name[RW]
callback_object_id[RW]
object[RW]
weakref[RW]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/flirt/callback.rb, line 12 def initialize(opts = {}) self.callback_name = opts.fetch(:callback_name) callback_object = opts.fetch(:object) self.weakref = !!opts[:weakref] self.object = weakref ? WeakRef.new(callback_object) : callback_object self.callback_object_id = callback_object.object_id end
Public Instance Methods
==(other_callback)
click to toggle source
# File lib/flirt/callback.rb, line 33 def ==(other_callback) callback_object_id == other_callback.callback_object_id && callback_name == other_callback.callback_name end
alive?()
click to toggle source
# File lib/flirt/callback.rb, line 27 def alive? return true unless weakref object.weakref_alive? end
call(event_data)
click to toggle source
# File lib/flirt/callback.rb, line 21 def call(event_data) return unless alive? object.send callback_name, event_data end