fat_core 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -5
- data/lib/fat_core/period.rb +3 -1
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/period_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d000b065f782f0546bf962200c5f116e967d80a6
|
4
|
+
data.tar.gz: ac1d4d5be0a403a0fc9fc9ec6d824feb0020d8a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad43b96b23a701ec911e90d7d506b50ba75bc8c82049559e0bec3995bf8d8ef7874524851385a5825599d39d00c8ea1d9ce2784b2ba7e5d0c2c86acca473354
|
7
|
+
data.tar.gz: b5e704fe49917fea1d1753a9e1874e330616b0d6cf698b70a4d1be7b30dbba864c560f6b278b549db889340e63be26776eb5b3a35531b0fe57b0fd87dfb4daf5
|
data/Gemfile
CHANGED
data/lib/fat_core/period.rb
CHANGED
@@ -133,7 +133,9 @@ class Period
|
|
133
133
|
def self.parse(from, to = nil)
|
134
134
|
raise ArgumentError, 'Period.parse missing argument' unless from
|
135
135
|
to ||= from
|
136
|
-
|
136
|
+
first = Date.parse_spec(from, :from)
|
137
|
+
second = Date.parse_spec(to, :to)
|
138
|
+
Period.new(first, second) if first && second
|
137
139
|
end
|
138
140
|
|
139
141
|
# Return a period from a phrase in which the from date is introduced with
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/period_spec.rb
CHANGED
@@ -108,6 +108,10 @@ describe Period do
|
|
108
108
|
expect(pd.last).to eq(Date.parse('2012-12-31'))
|
109
109
|
end
|
110
110
|
|
111
|
+
it 'should return nil when parsing never' do
|
112
|
+
expect(Period.parse('never')).to be_nil
|
113
|
+
end
|
114
|
+
|
111
115
|
it 'should know how to parse a pair of date specs' do
|
112
116
|
expect(Period.parse('2014-3Q').first).to eq Date.parse('2014-07-01')
|
113
117
|
expect(Period.parse('2014-3Q').last).to eq Date.parse('2014-09-30')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|