time_sentence 1.0.0 → 1.0.1
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.
- data/.gitignore +3 -1
- data/lib/ext/ts_time.rb +1 -1
- data/lib/time_sentence/version.rb +1 -1
- data/spec/time_sentence/sentence_spec.rb +6 -0
- metadata +3 -4
data/.gitignore
CHANGED
data/lib/ext/ts_time.rb
CHANGED
@@ -25,7 +25,7 @@ class Time
|
|
25
25
|
# Tracks what the values and names of each unit, as well as the
|
26
26
|
# conversion factor needed to go to the next larger unit
|
27
27
|
time = [
|
28
|
-
{ value: seconds.abs, unit: 'second', conversion: 60 },
|
28
|
+
{ value: seconds.abs.round, unit: 'second', conversion: 60 },
|
29
29
|
{ value: 0, unit: 'minute', conversion: 60 },
|
30
30
|
{ value: 0, unit: 'hour', conversion: 24 },
|
31
31
|
{ value: 0, unit: 'day', conversion: 7 },
|
@@ -36,4 +36,10 @@ describe 'Time.to_sentence' do
|
|
36
36
|
123456789123456789.to_time_sentence(20).should be_kind_of String
|
37
37
|
end
|
38
38
|
|
39
|
+
require 'active_support/core_ext/numeric'
|
40
|
+
|
41
|
+
it "should round seconds to integers" do
|
42
|
+
(1.day + 3.hours + 56.23456454.seconds).to_time_sentence.should eql "1 day, 3 hours, 56 seconds"
|
43
|
+
end
|
44
|
+
|
39
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_sentence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -115,11 +115,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project: time_sentence
|
118
|
-
rubygems_version: 1.8.
|
118
|
+
rubygems_version: 1.8.25
|
119
119
|
signing_key:
|
120
120
|
specification_version: 3
|
121
121
|
summary: Translates Seconds into Human Readable Sentences
|
122
122
|
test_files:
|
123
123
|
- spec/spec_helper.rb
|
124
124
|
- spec/time_sentence/sentence_spec.rb
|
125
|
-
has_rdoc:
|