Class: Bumbleworks::Tracker
- Inherits:
-
Object
- Object
- Bumbleworks::Tracker
- Defined in:
- lib/bumbleworks/tracker.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#original_hash ⇒ Object
readonly
Returns the value of attribute original_hash.
Class Method Summary collapse
Instance Method Summary collapse
- #action ⇒ Object
- #conditions ⇒ Object
- #global? ⇒ Boolean
-
#initialize(id, original_hash = nil) ⇒ Tracker
constructor
A new instance of Tracker.
- #process ⇒ Object
- #tags ⇒ Object
- #waiting_expression ⇒ Object
- #wfid ⇒ Object
- #where_clause ⇒ Object
Constructor Details
#initialize(id, original_hash = nil) ⇒ Tracker
Returns a new instance of Tracker.
17 18 19 20 |
# File 'lib/bumbleworks/tracker.rb', line 17 def initialize(id, original_hash = nil) @id = id @original_hash = original_hash || Bumbleworks.dashboard.get_trackers[id] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/bumbleworks/tracker.rb', line 3 def id @id end |
#original_hash ⇒ Object (readonly)
Returns the value of attribute original_hash.
3 4 5 |
# File 'lib/bumbleworks/tracker.rb', line 3 def original_hash @original_hash end |
Class Method Details
.all ⇒ Object
6 7 8 9 10 |
# File 'lib/bumbleworks/tracker.rb', line 6 def all Bumbleworks.dashboard.get_trackers.map do |tid, attrs| new(tid, attrs) end end |
.count ⇒ Object
12 13 14 |
# File 'lib/bumbleworks/tracker.rb', line 12 def count all.count end |
Instance Method Details
#action ⇒ Object
44 45 46 |
# File 'lib/bumbleworks/tracker.rb', line 44 def action @original_hash['action'] end |
#conditions ⇒ Object
36 37 38 |
# File 'lib/bumbleworks/tracker.rb', line 36 def conditions @original_hash['conditions'] || {} end |
#global? ⇒ Boolean
32 33 34 |
# File 'lib/bumbleworks/tracker.rb', line 32 def global? @original_hash['wfid'].nil? end |
#process ⇒ Object
26 27 28 29 30 |
# File 'lib/bumbleworks/tracker.rb', line 26 def process if wfid_from_hash = wfid Bumbleworks::Process.new(wfid_from_hash) end end |
#tags ⇒ Object
40 41 42 |
# File 'lib/bumbleworks/tracker.rb', line 40 def [conditions['tag']].flatten.compact end |
#waiting_expression ⇒ Object
48 49 50 51 |
# File 'lib/bumbleworks/tracker.rb', line 48 def waiting_expression return nil unless fei process.expression_at_position(fei['expid']).tree end |
#wfid ⇒ Object
22 23 24 |
# File 'lib/bumbleworks/tracker.rb', line 22 def wfid wfid = fei ? fei['wfid'] : @original_hash['wfid'] end |
#where_clause ⇒ Object
53 54 55 56 57 |
# File 'lib/bumbleworks/tracker.rb', line 53 def where_clause we = waiting_expression return nil unless we we[1]['where'] end |