Class: Ruote::ProcessStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/ruote-kit/helpers/json_helpers.rb

Overview

Re-opening to provide an as_h method

Instance Method Summary collapse

Instance Method Details

#as_h(detailed = true) ⇒ Object



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/ruote-kit/helpers/json_helpers.rb', line 186

def as_h(detailed=true)

  h = {}

  #h['expressions'] = @expressions.collect { |e| e.fei.to_h }
  #h['errors'] = @errors.collect { |e| e.to_h }

  h['type'] = 'process'
  h['detailed'] = detailed
  h['expressions'] = @expressions.size
  h['errors'] = @errors.size
  h['stored_workitems'] = @stored_workitems.size
  h['workitems'] = workitems.size

  h['root_expression_state'] = root_expression_state

  properties = %w[
    wfid
    definition_name definition_revision
    current_tree
    launched_time
    last_active
    tags
  ]

  properties += %w[
    original_tree
    variables
  ] if detailed

  properties.each { |m|
    h[m] = self.send(m)
  }

  h
end

#root_expression_stateObject



223
224
225
226
# File 'lib/ruote-kit/helpers/json_helpers.rb', line 223

def root_expression_state

  @root_expression ? @root_expression.state : '(no root expression)'
end