pretty_time 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/pretty_time/pretty_time.rb +4 -0
- data/pretty_time.gemspec +2 -2
- data/spec/pretty_time/pretty_time_spec.rb +7 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -131,6 +131,10 @@ class PrettyTime
|
|
131
131
|
|
132
132
|
# Core method that does all the work
|
133
133
|
def load(time_in_secs)
|
134
|
+
if time_in_secs.kind_of? Float
|
135
|
+
time_in_secs = time_in_secs.round
|
136
|
+
end
|
137
|
+
|
134
138
|
hours, minutes, seconds = hours_and_minutes_and_seconds(time_in_secs)
|
135
139
|
|
136
140
|
time_as_pretty_string = ""
|
data/pretty_time.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pretty_time}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Anuj Dutta"]
|
12
|
-
s.date = %q{2011-05
|
12
|
+
s.date = %q{2011-08-05}
|
13
13
|
s.description = %q{Serializes time to pretty time string and vica-versa}
|
14
14
|
s.email = %q{anuj@andhapp.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -246,7 +246,13 @@ describe "PrettyTime" do
|
|
246
246
|
it 'should convert 7810 seconds to 2 hours 10 minutes 10 seconds' do
|
247
247
|
PrettyTime.load(2.hours.to_i + 10.minutes.to_i + 10).should == "2 hours 10 minutes 10 seconds"
|
248
248
|
end
|
249
|
-
|
249
|
+
|
250
|
+
context "with seconds in floating point" do
|
251
|
+
it "should always round down to no decimal points" do
|
252
|
+
PrettyTime.load(1568.74).should == "26 minutes 9 seconds"
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
250
256
|
context "with configuration defined" do
|
251
257
|
|
252
258
|
it 'with hours_suffix as hrs and minutes and seconds as default should convert 7800 seconds to 2 hrs 10 minutes' do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: pretty_time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Anuj Dutta
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05
|
13
|
+
date: 2011-08-05 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
hash: -
|
119
|
+
hash: -1034395153
|
120
120
|
segments:
|
121
121
|
- 0
|
122
122
|
version: "0"
|