dotiw 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,12 @@ Also if one of the measurement is zero it will not output it:
12
12
 
13
13
  Better than "about 1 year", am I right? Of course I am.
14
14
 
15
+ "But Ryan!", you say, "What happens if the time is only in seconds but because of the default the seconds aren't shown? Won't it be blank?"
16
+ "No!" I triumphantly reply:
17
+
18
+ >> distance_of_time_in_words(Time.now, Time.now + 1.second, false)
19
+ => "1 second"
20
+
15
21
  This takes the same options plus an additional one on the end for passing options to the output (which uses `to_sentence`).
16
22
 
17
23
  Oh, and did I mention it supports I18n? Oh yeah.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dotiw}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Bigg"]
12
- s.date = %q{2010-01-29}
12
+ s.date = %q{2010-02-01}
13
13
  s.description = %q{Better distance_of_time_in_words for Rails}
14
14
  s.email = %q{radarlistener@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -69,7 +69,7 @@ module ActionView
69
69
 
70
70
  def display_time_in_words(hash, include_seconds = false, options = {})
71
71
  options.symbolize_keys!
72
- hash.delete(:seconds) if !include_seconds
72
+ hash.delete(:seconds) if !include_seconds && hash[:minutes]
73
73
  I18n.with_options :locale => options[:locale] do |locale|
74
74
  # Remove all the values that are nil.
75
75
  time_measurements = [locale.t(:years, :default => "years"),
@@ -131,6 +131,11 @@ describe "A better distance_of_time_in_words" do
131
131
  distance_of_time_in_words(start, finish, true, options).should eql(output)
132
132
  end
133
133
  end
134
+
135
+ it "outputs seconds regardless of include_seconds setting if only seconds have passed" do
136
+ distance_of_time_in_words(Time.now, Time.now + 1.second).should eql("1 second")
137
+ end
138
+
134
139
  end
135
140
 
136
141
  describe "percentage of time" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotiw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-29 00:00:00 +10:00
12
+ date: 2010-02-01 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency