Class: Bridge::Util::CallbackReference
- Inherits:
-
Proc
- Object
- Proc
- Bridge::Util::CallbackReference
- Defined in:
- lib/util.rb
Instance Method Summary collapse
- #call(*args, &blk) ⇒ Object
- #callback(*args, &blk) ⇒ Object
-
#initialize(ref) ⇒ CallbackReference
constructor
A new instance of CallbackReference.
- #method(atom) ⇒ Object
- #methods(bool) ⇒ Object
- #respond_to?(atom) ⇒ Boolean
- #to_dict(op = nil) ⇒ Object
Constructor Details
#initialize(ref) ⇒ CallbackReference
Returns a new instance of CallbackReference.
64 65 66 |
# File 'lib/util.rb', line 64 def initialize ref @ref = ref end |
Instance Method Details
#call(*args, &blk) ⇒ Object
73 74 75 76 |
# File 'lib/util.rb', line 73 def call *args, &blk args << blk if blk @ref.callback *args end |
#callback(*args, &blk) ⇒ Object
68 69 70 71 |
# File 'lib/util.rb', line 68 def callback *args, &blk args << blk if blk @ref.callback *args end |
#method(atom) ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/util.rb', line 78 def method atom if atom.to_s == 'callback' self else Class.method atom end end |
#methods(bool) ⇒ Object
86 87 88 |
# File 'lib/util.rb', line 86 def methods bool [:callback] end |
#respond_to?(atom) ⇒ Boolean
94 95 96 |
# File 'lib/util.rb', line 94 def respond_to? atom atom == :callback || atom == :to_dict || Class.respond_to?(atom) end |
#to_dict(op = nil) ⇒ Object
90 91 92 |
# File 'lib/util.rb', line 90 def to_dict op = nil @ref.to_dict op end |