motion-tickspot 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tick/timer.rb +28 -22
  3. data/lib/tick/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a76a3525bf556cce1dea6e27d12bd5b1f3549bcf
4
- data.tar.gz: 40ab8b30c177eb56fddd7bc58afd4b60af475a6f
3
+ metadata.gz: c3c0516c03911d15c88c2c3c5dbbcd141db08d94
4
+ data.tar.gz: 433c1a7e6e1e8703ba8cda7ffdc87c56a18d296c
5
5
  SHA512:
6
- metadata.gz: bc6fa493c0d685a50ed19d4edeb3bdfecd1672f243c96b68af442dcae22a15dfa84554e46a27d6176428f243900964ef1c8fd3a6c78aa1bad479c369623167da
7
- data.tar.gz: df91bb2c55f7fcd3cbaa9dbb361bd378f2e1db96d9abe7226c002a6cc4a6bb29d2643c7787e208e0b128abf5b7abeeb5fe716b41359a83891fef440981c9f158
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.list.delete(self)
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
- unless self.class.list.include?(self)
56
- self.class.list << self
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
- def self.current
113
- list.select{|timer|
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
- def self.start_with_task(task)
123
- timer = list.select{|timer|
124
- timer.task.id == task.id
125
- }.first
116
+ def current
117
+ list.select{|timer|
118
+ timer.is_running
119
+ }.first
120
+ end
126
121
 
127
- if timer.nil?
128
- timer = new
129
- timer.task = task
122
+ def list
123
+ timers || []
130
124
  end
131
125
 
132
- if timer.is_paused
133
- timer.start
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
@@ -1,3 +1,3 @@
1
1
  module Tick
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-tickspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison