Class: Bumbleworks::Tracker
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#==, #eql?, #hash, #identifier_for_comparison
Constructor Details
#initialize(id, original_hash = nil) ⇒ Tracker
Returns a new instance of Tracker.
18
19
20
21
|
# File 'lib/bumbleworks/tracker.rb', line 18
def initialize(id, original_hash = nil)
@id = id
@original_hash = original_hash || Bumbleworks.dashboard.get_trackers[id]
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3
4
5
|
# File 'lib/bumbleworks/tracker.rb', line 3
def id
@id
end
|
#original_hash ⇒ Object
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
7
8
9
10
11
|
# File 'lib/bumbleworks/tracker.rb', line 7
def all
Bumbleworks.dashboard.get_trackers.map do |tid, attrs|
new(tid, attrs)
end
end
|
.count ⇒ Object
13
14
15
|
# File 'lib/bumbleworks/tracker.rb', line 13
def count
all.count
end
|
Instance Method Details
#action ⇒ Object
45
46
47
|
# File 'lib/bumbleworks/tracker.rb', line 45
def action
@original_hash['action']
end
|
#conditions ⇒ Object
37
38
39
|
# File 'lib/bumbleworks/tracker.rb', line 37
def conditions
@original_hash['conditions'] || {}
end
|
#global? ⇒ Boolean
33
34
35
|
# File 'lib/bumbleworks/tracker.rb', line 33
def global?
@original_hash['wfid'].nil?
end
|
#process ⇒ Object
27
28
29
30
31
|
# File 'lib/bumbleworks/tracker.rb', line 27
def process
if wfid_from_hash = wfid
Bumbleworks::Process.new(wfid_from_hash)
end
end
|
41
42
43
|
# File 'lib/bumbleworks/tracker.rb', line 41
def tags
[conditions['tag']].flatten.compact
end
|
#waiting_expression ⇒ Object
49
50
51
52
|
# File 'lib/bumbleworks/tracker.rb', line 49
def waiting_expression
return nil unless fei
process.expression_at_position(fei['expid']).tree
end
|
#wfid ⇒ Object
23
24
25
|
# File 'lib/bumbleworks/tracker.rb', line 23
def wfid
wfid = fei ? fei['wfid'] : @original_hash['wfid']
end
|
#where_clause ⇒ Object
54
55
56
57
58
|
# File 'lib/bumbleworks/tracker.rb', line 54
def where_clause
we = waiting_expression
return nil unless we
we[1]['where']
end
|