Class: Bumbleworks::Expression

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flow_expression) ⇒ Expression

Returns a new instance of Expression.



12
13
14
15
16
# File 'lib/bumbleworks/expression.rb', line 12

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

Instance Attribute Details

#expidObject (readonly)

Returns the value of attribute expid.



3
4
5
# File 'lib/bumbleworks/expression.rb', line 3

def expid
  @expid
end

#feiObject (readonly)

Returns the value of attribute fei.



3
4
5
# File 'lib/bumbleworks/expression.rb', line 3

def fei
  @fei
end

Class Method Details

.from_fei(fei) ⇒ Object



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

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

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/bumbleworks/expression.rb', line 18

def ==(other)
  @fei == other.fei
end

#cancel!Object

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



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

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.



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

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.



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

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.



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

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

#treeObject

Returns the process tree at this expression.



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

def tree
  @flow_expression.tree
end

#workitemObject

Returns the workitem as it was applied to this expression.



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

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