dotiw 5.3.0 → 5.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1c8a832bcdb740a88002dec2f5c843daeca75b2674b2e31c26abc17a144c6a2
4
- data.tar.gz: 163a34f6e15e34026375176118399cc65ed73b2f723dab436bc9aedaf36dc0b7
3
+ metadata.gz: 36c95ebe9c3f26cad8de3f4671810af863f765b14f0c5066d761b84881515935
4
+ data.tar.gz: 76b3a723afd1e060a71e148c1b2f839460e325848de32b94d1d0fe701266f266
5
5
  SHA512:
6
- metadata.gz: 6e1a5291d51d629e4fc27d3f915f84586089be0869a676107154ef5f865c46fac768c4a2e7d86ac5fdfc2aadc879b668923f130f2f75ad0c355cbb86a5b18cc4
7
- data.tar.gz: f575e5e232a5adfefd8f81aa15f132dc352d020233bd1f66f6cddca473031d5cce0abf76bfd0842e0b55c3c60d4a44e2e7cf56a28b6e6fc89245e9fd17705bd7
6
+ metadata.gz: 25bbeae402bf0addf41bfdd5b0a7b7e23c51c528c1905714abad73696fa62cc8fb79eb6721fac8e69e1c8ca86c1d72c0fb04e7d8728b196d1dde5158df1cc035
7
+ data.tar.gz: 8d63f397602b8f07df9c4d0a1f60f10c48a19b8e01ee3346305bb364e3a18b74670032cdb37f6b1c6da8f26eb2e056ebb5b7f0940798c5bc133b612765500233
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.3.1 (2021/03/26)
2
+
3
+ * [#124](https://github.com/radar/distance_of_time_in_words/pull/124): Fixes compact formatting for distance_of_time_in_words - [@rposborne](https://github.com/rposborne).
4
+
1
5
  ## 5.3.0 (2021/03/18)
2
6
 
3
7
  * [#115](https://github.com/radar/distance_of_time_in_words/pull/115): Use constants for time durations (2x faster, 3.5x less memory) - [@krzysiek1507](https://github.com/krzysiek1507).
data/lib/dotiw/methods.rb CHANGED
@@ -102,7 +102,7 @@ module DOTIW
102
102
  default: :'support.array.last_word_connector',
103
103
  locale: options[:locale]
104
104
 
105
- output.to_sentence(options.except(:accumulate_on))
105
+ output.to_sentence(options.except(:accumulate_on, :compact))
106
106
  end
107
107
  end
108
108
  end
data/lib/dotiw/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DOTIW
4
- VERSION = '5.3.0'
4
+ VERSION = '5.3.1'
5
5
  end
@@ -135,32 +135,33 @@ describe 'A better distance_of_time_in_words' do
135
135
  end
136
136
 
137
137
  [
138
- [START_TIME, START_TIME + 5.days + 3.minutes, '5 days and 3 minutes'],
139
- [START_TIME, START_TIME + 1.minute, '1 minute'],
140
- [START_TIME, START_TIME + 3.years, '3 years'],
141
- [START_TIME, START_TIME + 10.years, '10 years'],
142
- [START_TIME, START_TIME + 8.months, '8 months'],
143
- [START_TIME, START_TIME + 3.hour, '3 hours'],
144
- [START_TIME, START_TIME + 13.months, '1 year and 1 month'],
138
+ [START_TIME, START_TIME + 5.days + 3.minutes, '5 days and 3 minutes', '5d3m'],
139
+ [START_TIME, START_TIME + 1.minute, '1 minute', '1m'],
140
+ [START_TIME, START_TIME + 3.years, '3 years', '3y'],
141
+ [START_TIME, START_TIME + 10.years, '10 years', '10y'],
142
+ [START_TIME, START_TIME + 8.months, '8 months', '8mo'],
143
+ [START_TIME, START_TIME + 3.hour, '3 hours', '3h'],
144
+ [START_TIME, START_TIME + 13.months, '1 year and 1 month', '1y1mo'],
145
145
  # Any numeric sequence is merely coincidental.
146
146
  [START_TIME, START_TIME + 1.year + 2.months + 3.weeks + 4.days + 5.hours + 6.minutes + 7.seconds,
147
- '1 year, 2 months, 3 weeks, 4 days, 5 hours, 6 minutes, and 7 seconds'],
148
- ['2009-3-16'.to_time, '2008-4-14'.to_time, '11 months and 2 days'],
149
- ['2009-3-16'.to_time + 1.minute, '2008-4-14'.to_time, '11 months, 2 days, and 1 minute'],
150
- ['2009-4-14'.to_time, '2008-3-16'.to_time, '1 year, 4 weeks, and 1 day'],
151
- ['2009-2-01'.to_time, '2009-3-01'.to_time, '1 month'],
152
- ['2008-2-01'.to_time, '2008-3-01'.to_time, '1 month'],
153
- [Date.parse('31.03.2015').to_time, Time.parse('01.03.2016'), '10 months, 4 weeks, and 2 days'],
154
- [Date.new(2014, 1, 31), Date.new(2014, 3, 1), '4 weeks and 1 day'],
155
- ['2008-2-01'.to_time, '2008-3-01'.to_time, '1 month'],
156
- ['2014-1-31'.to_time, '2014-3-01'.to_time, '4 weeks and 1 day'],
157
- ['2014-1-31'.to_time, '2014-3-02'.to_time, '4 weeks and 2 days'],
158
- ['2016-1-31'.to_time, '2016-3-01'.to_time, '4 weeks and 2 days'],
159
- ['2016-1-31'.to_time, '2016-3-02'.to_time, '1 month']
160
- ].each do |start, finish, output|
147
+ '1 year, 2 months, 3 weeks, 4 days, 5 hours, 6 minutes, and 7 seconds', '1y2mo3w4d5h6m7s'],
148
+ ['2009-3-16'.to_time, '2008-4-14'.to_time, '11 months and 2 days', '11mo2d'],
149
+ ['2009-3-16'.to_time + 1.minute, '2008-4-14'.to_time, '11 months, 2 days, and 1 minute', '11mo2d1m'],
150
+ ['2009-4-14'.to_time, '2008-3-16'.to_time, '1 year, 4 weeks, and 1 day', '1y4w1d'],
151
+ ['2009-2-01'.to_time, '2009-3-01'.to_time, '1 month', '1mo'],
152
+ ['2008-2-01'.to_time, '2008-3-01'.to_time, '1 month', '1mo'],
153
+ [Date.parse('31.03.2015').to_time, Time.parse('01.03.2016'), '10 months, 4 weeks, and 2 days', '10mo4w2d'],
154
+ [Date.new(2014, 1, 31), Date.new(2014, 3, 1), '4 weeks and 1 day', '4w1d'],
155
+ ['2008-2-01'.to_time, '2008-3-01'.to_time, '1 month', '1mo'],
156
+ ['2014-1-31'.to_time, '2014-3-01'.to_time, '4 weeks and 1 day', '4w1d'],
157
+ ['2014-1-31'.to_time, '2014-3-02'.to_time, '4 weeks and 2 days', '4w2d'],
158
+ ['2016-1-31'.to_time, '2016-3-01'.to_time, '4 weeks and 2 days', '4w2d'],
159
+ ['2016-1-31'.to_time, '2016-3-02'.to_time, '1 month', '1mo']
160
+ ].each do |start, finish, output, compact_result|
161
161
  it "should be #{output}" do
162
162
  expect(distance_of_time_in_words(start, finish, true)).to eq(output)
163
163
  expect(distance_of_time_in_words(finish, start, true)).to eq(output)
164
+ expect(distance_of_time_in_words(start, finish, true, compact: true)).to eq(compact_result)
164
165
  end
165
166
  end
166
167
 
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: 5.3.0
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-18 00:00:00.000000000 Z
12
+ date: 2021-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport