motion-tickspot 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tick/timer.rb +28 -22
- data/lib/tick/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3c0516c03911d15c88c2c3c5dbbcd141db08d94
|
4
|
+
data.tar.gz: 433c1a7e6e1e8703ba8cda7ffdc87c56a18d296c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4977ed7df127b05354934d9949303b6b9c65b5d2cbb4733eead1a5499fcf79ddfcf95fe39d3c846f724297ab5a4e3a1434743c2544e9998d556ccc43911ac9f
|
7
|
+
data.tar.gz: 1cc4e876249a475f49a7dca54a35326bdc3a427620e11ee962e0a27a2dcf3274a24853a6af23e55c00faa9d4f5251b23f1a0a141d4d656544dc2b6a764ec2354
|
data/lib/tick/timer.rb
CHANGED
@@ -6,7 +6,7 @@ module Tick
|
|
6
6
|
def clear
|
7
7
|
self.start_time = nil
|
8
8
|
self.time_spans = []
|
9
|
-
self.class.
|
9
|
+
self.class.timers.delete(self)
|
10
10
|
true
|
11
11
|
end
|
12
12
|
|
@@ -52,8 +52,9 @@ module Tick
|
|
52
52
|
# Start the timer and add it to the
|
53
53
|
# list of timers if it doesn't exist
|
54
54
|
self.start_time = Time.now
|
55
|
-
|
56
|
-
|
55
|
+
self.class.timers ||= []
|
56
|
+
unless self.class.timers.include?(self)
|
57
|
+
self.class.timers << self
|
57
58
|
end
|
58
59
|
|
59
60
|
true
|
@@ -109,31 +110,36 @@ module Tick
|
|
109
110
|
@time_spans ||= []
|
110
111
|
end
|
111
112
|
|
112
|
-
|
113
|
-
|
114
|
-
timer.is_running
|
115
|
-
}.first
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.list
|
119
|
-
@@list ||= []
|
120
|
-
end
|
113
|
+
class << self
|
114
|
+
attr_accessor :timers
|
121
115
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
116
|
+
def current
|
117
|
+
list.select{|timer|
|
118
|
+
timer.is_running
|
119
|
+
}.first
|
120
|
+
end
|
126
121
|
|
127
|
-
|
128
|
-
|
129
|
-
timer.task = task
|
122
|
+
def list
|
123
|
+
timers || []
|
130
124
|
end
|
131
125
|
|
132
|
-
|
133
|
-
timer.
|
126
|
+
def start_with_task(task)
|
127
|
+
timer = list.select{|timer|
|
128
|
+
timer.task.id == task.id
|
129
|
+
}.first
|
130
|
+
|
131
|
+
if timer.nil?
|
132
|
+
timer = new
|
133
|
+
timer.task = task
|
134
|
+
end
|
135
|
+
|
136
|
+
if timer.is_paused
|
137
|
+
timer.start
|
138
|
+
end
|
139
|
+
|
140
|
+
timer
|
134
141
|
end
|
135
142
|
|
136
|
-
timer
|
137
143
|
end
|
138
144
|
|
139
145
|
end
|
data/lib/tick/version.rb
CHANGED