Class: Spank::Invocation
- Inherits:
-
Object
- Object
- Spank::Invocation
- Defined in:
- lib/spank/invocation.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(instance, method, args, block) ⇒ Invocation
constructor
A new instance of Invocation.
- #proceed ⇒ Object
Constructor Details
#initialize(instance, method, args, block) ⇒ Invocation
Returns a new instance of Invocation.
5 6 7 8 9 10 |
# File 'lib/spank/invocation.rb', line 5 def initialize(instance, method, args, block) @instance = instance @method = method @arguments = args @block = block end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
3 4 5 |
# File 'lib/spank/invocation.rb', line 3 def arguments @arguments end |
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
3 4 5 |
# File 'lib/spank/invocation.rb', line 3 def instance @instance end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/spank/invocation.rb', line 3 def method @method end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
3 4 5 |
# File 'lib/spank/invocation.rb', line 3 def result @result end |
Instance Method Details
#proceed ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/spank/invocation.rb', line 12 def proceed if @block @result = @instance.public_send(@method, @arguments, @block) else @result = @instance.public_send(@method, @arguments) end end |