Class: Savon::BlockInterface
- Inherits:
-
Object
- Object
- Savon::BlockInterface
- Defined in:
- lib/savon/block_interface.rb
Instance Method Summary collapse
- #evaluate(block) ⇒ Object
-
#initialize(target) ⇒ BlockInterface
constructor
A new instance of BlockInterface.
Constructor Details
#initialize(target) ⇒ BlockInterface
Returns a new instance of BlockInterface.
4 5 6 |
# File 'lib/savon/block_interface.rb', line 4 def initialize(target) @target = target end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
19 20 21 22 23 |
# File 'lib/savon/block_interface.rb', line 19 def method_missing(method, *args, &block) @target.send(method, *args, &block) rescue NoMethodError @original.send(method, *args, &block) end |
Instance Method Details
#evaluate(block) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/savon/block_interface.rb', line 8 def evaluate(block) if block.arity > 0 block.call(@target) else @original = eval("self", block.binding) instance_eval(&block) end end |