Class: Bridge::Serializer::Callback
- Inherits:
-
Object
- Object
- Bridge::Serializer::Callback
- Defined in:
- lib/serializer.rb
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #callback(*args) ⇒ Object
-
#initialize(fun) ⇒ Callback
constructor
A new instance of Callback.
- #method(atom) ⇒ Object
- #methods(bool) ⇒ Object
- #respond_to?(atom) ⇒ Boolean
Constructor Details
#initialize(fun) ⇒ Callback
Returns a new instance of Callback.
73 74 75 |
# File 'lib/serializer.rb', line 73 def initialize fun @fun = fun end |
Instance Method Details
#call(*args) ⇒ Object
81 82 83 |
# File 'lib/serializer.rb', line 81 def call *args @fun.call(*args) end |
#callback(*args) ⇒ Object
77 78 79 |
# File 'lib/serializer.rb', line 77 def callback *args @fun.call *args end |
#method(atom) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/serializer.rb', line 85 def method atom if atom.to_s == 'callback' @fun else Class.method atom end end |
#methods(bool) ⇒ Object
93 94 95 |
# File 'lib/serializer.rb', line 93 def methods bool [:callback] end |
#respond_to?(atom) ⇒ Boolean
97 98 99 |
# File 'lib/serializer.rb', line 97 def respond_to? atom atom.to_s == 'callback' || Class.respond_to?(atom) end |