time_frame 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 65713f31c104bfb6a45f3464066c6aab75fc5625
4
- data.tar.gz: 26482274bbefe471ed82898bb83ca54d9f0de24f
3
+ metadata.gz: be841fe7816dbb5c85074a9ba9bef9b7cc477705
4
+ data.tar.gz: a85edb9a79a5c3c46ea1b7ab9c1b078be45f4cda
5
5
  SHA512:
6
- metadata.gz: 33e2f6f6ac48f5c59b5e0adf7b49a0bb0482c1fb254fd6b385b3f1b09d2fa28a4399326809cfb81fd01df53922853ebc8f14cfd8bdbea0b4a4cef39bbf120c14
7
- data.tar.gz: fb4e69a35ae2df6e4ca0adcdf8feb498f5fc124f53613e68a5b02be9a7a0684d040c25261416516f068a6c0c70c427fbcf40beca0157cd0e25d49bb6539c921c
6
+ metadata.gz: af9f71e80444f81d744846cdf8542ef9b667a839c70f190500da282253220470bb32e2c0ff4211584dc4566fe4b955add8827854b84d36e01e2d812743613118
7
+ data.tar.gz: 1290ca3e9e1b0cb87934095cbff08319a34be33845abaa460a3682b016548013b6b06c7556487bd1c186987e6927f687dda32532c79bddbdf0ff76dd3496a891
@@ -1,8 +1,6 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext'
2
3
 
3
- # Avoid i18n deprecation warning
4
- I18n.enforce_available_locales = false
5
-
6
4
  require 'time_frame/time_frame_splitter'
7
5
  require 'time_frame/time_frame_covered'
8
6
  require 'time_frame/time_frame_overlaps'
@@ -9,14 +9,13 @@ class TimeFrame
9
9
 
10
10
  def unite
11
11
  frames = @sorted ? @time_frames : @time_frames.sort_by(&:min)
12
- frames.reduce([]) do |result, frame|
12
+ frames.each_with_object([]) do |frame, result|
13
13
  last_frame = result.last
14
14
  if last_frame && last_frame.cover?(frame.min)
15
15
  result[-1] = TimeFrame.new(min: last_frame.min, max: frame.max)
16
16
  else
17
17
  result << frame
18
18
  end
19
- result
20
19
  end
21
20
  end
22
21
  end
@@ -1,4 +1,4 @@
1
1
  # gem version
2
2
  class TimeFrame
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
@@ -4,6 +4,11 @@ describe TimeFrame do
4
4
  let(:time) { Time.zone.local(2012) }
5
5
  let(:duration) { 2.hours }
6
6
 
7
+ before do
8
+ # Avoid i18n deprecation warning
9
+ I18n.enforce_available_locales = true
10
+ end
11
+
7
12
  describe '#initialize' do
8
13
  context 'when given two times' do
9
14
  context 'and min is smaller than max' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_frame
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Derichs
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-19 00:00:00.000000000 Z
13
+ date: 2014-05-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport