time_array 0.5.7.4 → 0.5.7.5
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/time_array/compactor.rb +0 -42
- data/lib/time_array/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: 652a1907d9faf6cdb4eeb4d18bd16abe9aa66a8d
|
4
|
+
data.tar.gz: ea6b6a8873c17d4ea89de9be159442b0aea668fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227385a7ffb065ee7c1b29a7eb9bcc5d2d8ced91631016a9dea694b7e27d49ef84a21852bbb12e3e0fd6f24957bff04a2516e0227f3344aaf7f9860aca96f27b
|
7
|
+
data.tar.gz: b618064a2b501e8d4f2a7bbe8a652a9e93096919d6ba4e54d3aa5138faed93a28f336465887b82985520724eae59a97b16209ddfa8d03d85a68eead5f472a0a4
|
data/lib/time_array/compactor.rb
CHANGED
@@ -1,48 +1,6 @@
|
|
1
1
|
module TimeArray
|
2
2
|
|
3
3
|
|
4
|
-
class CompactorTime
|
5
|
-
attr_reader :time
|
6
|
-
def initialize(t)
|
7
|
-
@time = t
|
8
|
-
# @time = Time.new(t.year, t.month, t.day, t.hour, 0, 0)
|
9
|
-
end
|
10
|
-
|
11
|
-
def change(step=:hour)
|
12
|
-
nxt = @time+1.send(step)
|
13
|
-
[:year, :month, :day, :hour].each do |st|
|
14
|
-
return st if nxt.send(st)!=@time.send(st)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def increment(step=:hour)
|
19
|
-
@time+1.send(step)
|
20
|
-
end
|
21
|
-
|
22
|
-
def increment!(step=:hour)
|
23
|
-
@time = increment(step)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
class GreatestUnit
|
29
|
-
H = {eternity: 5, year: 4, month: 3, day: 2, hour: 1}
|
30
|
-
attr_reader :c
|
31
|
-
|
32
|
-
def initialize(initial_interval=:eternity)
|
33
|
-
@c = initial_interval
|
34
|
-
end
|
35
|
-
|
36
|
-
def set(interval)
|
37
|
-
@c = interval if H[interval]<H[@c]
|
38
|
-
end
|
39
|
-
|
40
|
-
def smallest
|
41
|
-
H.keys.last
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
4
|
class Compact
|
47
5
|
attr_reader :v, :unit
|
48
6
|
def initialize(v, unit)
|
data/lib/time_array/version.rb
CHANGED