Class: Savon::BlockInterface
- Inherits:
-
Object
- Object
- Savon::BlockInterface
show all
- Defined in:
- lib/savon/block_interface.rb
Instance Method Summary
collapse
Constructor Details
5
6
7
|
# File 'lib/savon/block_interface.rb', line 5
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
20
21
22
23
24
|
# File 'lib/savon/block_interface.rb', line 20
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
9
10
11
12
13
14
15
16
|
# File 'lib/savon/block_interface.rb', line 9
def evaluate(block)
if block.arity > 0
block.call(@target)
else
@original = eval("self", block.binding)
instance_eval(&block)
end
end
|