Class: Bumbleworks::Expression

Inherits:
Object
  • Object
show all
Includes:
Support::WrapperComparison
Defined in:
lib/bumbleworks/expression.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::WrapperComparison

#==, #eql?, #hash, #identifier_for_comparison

Constructor Details

#initialize(flow_expression) ⇒ Expression

Returns a new instance of Expression.



15
16
17
18
19
# File 'lib/bumbleworks/expression.rb', line 15

def initialize(flow_expression)
  @flow_expression = flow_expression
  @fei = @flow_expression.fei
  @expid = @fei.expid
end

Instance Attribute Details

#expidObject (readonly) Also known as: id

Returns the value of attribute expid.



5
6
7
# File 'lib/bumbleworks/expression.rb', line 5

def expid
  @expid
end

#feiObject (readonly)

Returns the value of attribute fei.



5
6
7
# File 'lib/bumbleworks/expression.rb', line 5

def fei
  @fei
end

Class Method Details

.from_fei(fei) ⇒ Object



9
10
11
12
# File 'lib/bumbleworks/expression.rb', line 9

def from_fei(fei)
  fexp = ::Ruote::Exp::FlowExpression.fetch(Bumbleworks.dashboard.context, fei)
  new(fexp)
end

Instance Method Details

#cancel!Object

Cancel this expression. The process will then move on to the next expression.



47
48
49
# File 'lib/bumbleworks/expression.rb', line 47

def cancel!
  Bumbleworks.dashboard.cancel_expression(@fei)
end

#errorObject

Returns a Bumbleworks::Process::ErrorRecord instance for the expression’s error, if there is one. If no error was raised during the execution of this expression, returns nil.

Note that what is returned is not the exception itself that was raised during execution, but rather a record of that error. If you want a re-created instance of the actual exception, you can call #reify on the ErrorRecord instance returned.



41
42
43
# File 'lib/bumbleworks/expression.rb', line 41

def error
  @error ||= ruote_error
end

#kill!Object

Kill this expression. The process will then move on to the next expression.

WARNING: Killing an expression will not trigger any ‘on_cancel’ callbacks. It’s preferable to #cancel! the expression if you can.



57
58
59
# File 'lib/bumbleworks/expression.rb', line 57

def kill!
  Bumbleworks.dashboard.kill_expression(@fei)
end

#processObject

Returns a Bumbleworks::Process instance for the expression’s wfid; effectively, the process instance this expression is a part of.



24
25
26
# File 'lib/bumbleworks/expression.rb', line 24

def process
  @process ||= Bumbleworks::Process.new(@fei.wfid)
end

#treeObject

Returns the process tree at this expression.



29
30
31
# File 'lib/bumbleworks/expression.rb', line 29

def tree
  @flow_expression.tree
end

#workitemObject

Returns the workitem as it was applied to this expression.



62
63
64
# File 'lib/bumbleworks/expression.rb', line 62

def workitem
  Workitem.new(@flow_expression.applied_workitem)
end