Class: Bumbleworks::Schedule
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#==, #eql?, #hash, #identifier_for_comparison
Constructor Details
#initialize(schedule_hash) ⇒ Schedule
Returns a new instance of Schedule.
18
19
20
21
|
# File 'lib/bumbleworks/schedule.rb', line 18
def initialize(schedule_hash)
@original_hash = schedule_hash
@id = @original_hash['_id']
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3
4
5
|
# File 'lib/bumbleworks/schedule.rb', line 3
def id
@id
end
|
#original_hash ⇒ Object
Returns the value of attribute original_hash.
3
4
5
|
# File 'lib/bumbleworks/schedule.rb', line 3
def original_hash
@original_hash
end
|
Class Method Details
.all ⇒ Object
7
8
9
10
11
|
# File 'lib/bumbleworks/schedule.rb', line 7
def all
Bumbleworks.dashboard.schedules.map do |hsh|
new(hsh)
end
end
|
.count ⇒ Object
13
14
15
|
# File 'lib/bumbleworks/schedule.rb', line 13
def count
all.count
end
|
Instance Method Details
#next_at ⇒ Object
43
44
45
|
# File 'lib/bumbleworks/schedule.rb', line 43
def next_at
Time.parse(@original_hash['at'])
end
|
#once? ⇒ Boolean
39
40
41
|
# File 'lib/bumbleworks/schedule.rb', line 39
def once?
!repeating?
end
|
#original_plan ⇒ Object
47
48
49
|
# File 'lib/bumbleworks/schedule.rb', line 47
def original_plan
@original_hash['original']
end
|
#repeating? ⇒ Boolean
35
36
37
|
# File 'lib/bumbleworks/schedule.rb', line 35
def repeating?
['cron', 'every'].include? expression.tree[0]
end
|
#test_clause ⇒ Object
51
52
53
|
# File 'lib/bumbleworks/schedule.rb', line 51
def test_clause
expression.tree[1]['test']
end
|
#wfid ⇒ Object
23
24
25
|
# File 'lib/bumbleworks/schedule.rb', line 23
def wfid
@original_hash['wfid']
end
|