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.
66 67 68 |
# File 'lib/serializer.rb', line 66 def initialize fun @fun = fun end |
Instance Method Details
#call(*args) ⇒ Object
74 75 76 |
# File 'lib/serializer.rb', line 74 def call *args @fun.call(*args) end |
#callback(*args) ⇒ Object
70 71 72 |
# File 'lib/serializer.rb', line 70 def callback *args @fun.call *args end |
#method(atom) ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/serializer.rb', line 78 def method atom if atom.to_s == 'callback' @fun else Class.method atom end end |
#methods(bool) ⇒ Object
86 87 88 |
# File 'lib/serializer.rb', line 86 def methods bool [:callback] end |
#respond_to?(atom) ⇒ Boolean
90 91 92 |
# File 'lib/serializer.rb', line 90 def respond_to? atom atom.to_s == 'callback' || Class.respond_to?(atom) end |