Class: StateFlow::Context::Manipulation
- Inherits:
-
Object
- Object
- StateFlow::Context::Manipulation
- Defined in:
- lib/state_flow/context.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#trace ⇒ Object
readonly
Returns the value of attribute trace.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(context, target, method, *args, &block) ⇒ Manipulation
constructor
A new instance of Manipulation.
- #inspect ⇒ Object
Constructor Details
#initialize(context, target, method, *args, &block) ⇒ Manipulation
Returns a new instance of Manipulation.
122 123 124 125 126 |
# File 'lib/state_flow/context.rb', line 122 def initialize(context, target, method, *args, &block) @context = context @target, @method, @args, @block = target, method, args, block @trace = caller(3) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
119 120 121 |
# File 'lib/state_flow/context.rb', line 119 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
119 120 121 |
# File 'lib/state_flow/context.rb', line 119 def block @block end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
121 122 123 |
# File 'lib/state_flow/context.rb', line 121 def context @context end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
119 120 121 |
# File 'lib/state_flow/context.rb', line 119 def method @method end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
120 121 122 |
# File 'lib/state_flow/context.rb', line 120 def result @result end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
119 120 121 |
# File 'lib/state_flow/context.rb', line 119 def target @target end |
#trace ⇒ Object (readonly)
Returns the value of attribute trace.
120 121 122 |
# File 'lib/state_flow/context.rb', line 120 def trace @trace end |
Instance Method Details
#execute ⇒ Object
128 129 130 131 132 133 134 |
# File 'lib/state_flow/context.rb', line 128 def execute begin return @result = @target.send(@method, *@args, &@block) rescue Exception raise unless @context.force_recovering? end end |
#inspect ⇒ Object
136 137 138 139 140 141 142 |
# File 'lib/state_flow/context.rb', line 136 def inspect args_part = @args.inspect.gsub(/^\[|\]$/, '') if !args_part.nil? && !args_part.empty? args_part = "(#{args_part})" end "#{@target.class.name}##{@method}#{args_part}#{@block ? " with block" : nil}" end |