timer.rb 0.1 → 0.2

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.
@@ -18,7 +18,9 @@ You can install from Rubygems
18
18
  Or you can download the source and build it manually:
19
19
 
20
20
  $ git clone https://febuiles@github.com/febuiles/timer.rb.git
21
- $ rake install
21
+ $ cd timer.rb
22
+ $ gem build
23
+ $ gem install timer.rb --local
22
24
 
23
25
 
24
26
  Usage
@@ -15,14 +15,14 @@ module Timer
15
15
  time_chunks = duration
16
16
  end
17
17
 
18
- time_chunks.reject! { |c| c !~ /\d+[mhs]$/ }
18
+ time_chunks.reject! { |c| c !~ /\d+(\.\d+)?[mhs]$/ }
19
19
  hours += time_chunks.select {|c| c[-1,1] == "h" }
20
20
  mins += time_chunks.select {|c| c[-1,1] == "m" }
21
21
  secs += time_chunks.select {|c| c[-1,1] == "s" }
22
22
 
23
- total += hours.inject(0) { |sum, x| sum + (x.to_i * 3600) }
24
- total += mins.inject(0) { |sum, x| sum + (x.to_i * 60) }
25
- total += secs.inject(0) { |sum, x| sum + x.to_i }
23
+ total += hours.inject(0) { |sum, x| sum + (x.to_f * 3600) }
24
+ total += mins.inject(0) { |sum, x| sum + (x.to_f * 60) }
25
+ total += secs.inject(0) { |sum, x| sum + x.to_f }
26
26
 
27
27
  # nil otherwise
28
28
  total unless total == 0
@@ -30,4 +30,4 @@ module Timer
30
30
  end
31
31
  end
32
32
 
33
-
33
+ Timer::TimeParser.parse_duration("0.5m")
@@ -1,3 +1,3 @@
1
1
  module Timer
2
- Version = VERSION = '0.1'
2
+ Version = VERSION = '0.2'
3
3
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timer.rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Federico Builes
@@ -58,7 +58,6 @@ files:
58
58
  - lib/timer/timer.rb
59
59
  - lib/timer/version.rb
60
60
  - lib/timer.rb
61
- - bin/foo.rb
62
61
  - bin/timer.rb
63
62
  has_rdoc: false
64
63
  homepage: http://github.com/febuiles/timer.rb
data/bin/foo.rb DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- p ARGV.to_s