Class: Wf::Case

Inherits:
ApplicationRecord show all
Defined in:
app/models/wf/case.rb

Instance Method Summary collapse

Instance Method Details

#can_fire?(transition) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
# File 'app/models/wf/case.rb', line 35

def can_fire?(transition)
  ins = transition.arcs.in.to_a
  return false if ins.blank?

  ins.all? { |arc| arc.place.tokens.where(case: self).where(state: :free).exists? }
end

#nameObject



42
43
44
# File 'app/models/wf/case.rb', line 42

def name
  "Case->#{id}"
end