subunit 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4466d231e3c336adf393301ac33736362e1ba2996bfa0a42f2ca56be949ffbff
4
- data.tar.gz: daff11e883761163e31f79d431f91ad1ad10790f613359a0aa593a29da82a57a
3
+ metadata.gz: 04ff09dc79844ac6e631550fb7d3af0cd8a7253a6da25b37f4620f4ca2d0af2d
4
+ data.tar.gz: cdcb4a05cf28aef86d445e2abc3dedd9e735358e7b19ec27b272ba776dd6acc0
5
5
  SHA512:
6
- metadata.gz: cd3f645fc57ea4badfbc121d02ba36edc240b063bebb468804dfe5a451b9d6abf084b3c59cc346302fad9e2fbda381aa82831f677789ac6c8bfd99b305dbf9fd
7
- data.tar.gz: 2fefff70fc6f6144c2f4fc5c0c691bd354ce42f770478ad8c8c93e8860175d833021900fc2b84ef6a363bd45eda21ef8dd4d4bb9b4fa83632425609d8f0e69db
6
+ metadata.gz: f110323bf0bc4a33cbd62c43896fe6abc786320348ead1205a3422ffc827d25135681ce02300ee868e6f9ace6d69cc03bf2efa6010f992d33c76576778b37afd
7
+ data.tar.gz: b811c7fe06ecb53916f406a1d607ceb75b08345955d874cf754540d8b9e75c4de707a6f854932c9bed35a828141f96506e37dabb28f05a8e8fe544c44ffad91c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -20,6 +20,10 @@ class Subunit
20
20
  new(units={minutes:60, hours:60}, seconds: val)
21
21
  end
22
22
 
23
+ def self.hms_to_seconds(obj)
24
+ new(units={hours:60, minutes:60,seconds: 60, }, obj).to_i
25
+ end
26
+
23
27
  attr_reader :to_a, :to_h, :to_i
24
28
 
25
29
  def initialize(raw_units={}, obj)
@@ -27,14 +31,12 @@ class Subunit
27
31
  @debug = false
28
32
 
29
33
  @raw_units = raw_units
34
+
35
+ accumulate = ->(a) {
30
36
 
31
-
32
- accumulate = ->(obj) {
33
- a = obj[0..-2]
34
37
  len = raw_units.to_a.length
35
38
  val = ([0]*(len-1) + a).slice(-(len), len).zip(raw_units.values)\
36
- .inject(0) {|r,x| r + x.inject(:*) }
37
- val + obj[-1]
39
+ .inject(0) {|r,x| r * x[1] + x[0] }
38
40
  }
39
41
 
40
42
  if obj.is_a? String
@@ -170,3 +172,4 @@ class Subunit
170
172
  unit_list.length > 0 ? [unit] + scan_units(unit_list, subunit) : [unit, subunit]
171
173
  end
172
174
  end
175
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subunit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file