fat_core 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fat_core.gemspec +1 -0
- data/lib/core_extensions/date/fat_core.rb +7 -0
- data/lib/fat_core/period.rb +4 -0
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/period_spec.rb +11 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c84245c5d16bd9ed1f877d85b8a4b5f3dd86c2a
|
4
|
+
data.tar.gz: 17753f85febd4ca6c1cf59f3d51b39068eaf639c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 855688e57b168e2de66da4113c98da40776211468c16766428aa76a090ed901eaf8681d24469ef8df0e893e2afb024f1c45967fa354dddbe0e538d3090444849
|
7
|
+
data.tar.gz: eeefdbde9edbaa48be5bb4d095d647ebb669d74d3a0411af747e0f9b361849bb81d0b9ce8076f7a252c403043883fba3a13b2e1487bfbeed6c15e83328eb62dc
|
data/fat_core.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "rcodetools"
|
26
26
|
spec.add_development_dependency "byebug"
|
27
27
|
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "pry-doc"
|
28
29
|
|
29
30
|
spec.add_runtime_dependency "activesupport"
|
30
31
|
spec.add_runtime_dependency "erubis"
|
data/lib/fat_core/period.rb
CHANGED
@@ -100,6 +100,10 @@ class Period
|
|
100
100
|
self.contains?(date)
|
101
101
|
end
|
102
102
|
|
103
|
+
def trading_days
|
104
|
+
select(&:nyse_workday?)
|
105
|
+
end
|
106
|
+
|
103
107
|
# Return a period based on two date specs (see Date.parse_spec), a '''from'
|
104
108
|
# and a 'to' spec. If the to-spec is not given or is nil, the from-spec is
|
105
109
|
# used for both the from- and to-spec. If no from-spec is given, return
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/period_spec.rb
CHANGED
@@ -199,6 +199,17 @@ describe Period do
|
|
199
199
|
expect(pp === Date.parse('2012-07-04')).to be false
|
200
200
|
end
|
201
201
|
|
202
|
+
it "should be able to enumerate its days" do
|
203
|
+
Period.parse_spec('2014-12').each do |dy|
|
204
|
+
expect(dy.class).to eq Date
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should be able to return the trading days within period" do
|
209
|
+
tds = Period.parse_spec('2014-12').trading_days
|
210
|
+
expect(tds.count).to eq(22)
|
211
|
+
end
|
212
|
+
|
202
213
|
it "should know its size" do
|
203
214
|
pp = Period.new('2013-01-01', '2013-12-31')
|
204
215
|
expect(pp.size).to eq 365
|
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: 0.2.
|
4
|
+
version: 0.2.5
|
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: 2015-
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-doc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: activesupport
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +179,7 @@ files:
|
|
165
179
|
- README.md
|
166
180
|
- Rakefile
|
167
181
|
- fat_core.gemspec
|
182
|
+
- lib/core_extensions/date/fat_core.rb
|
168
183
|
- lib/fat_core.rb
|
169
184
|
- lib/fat_core/ChangeLog
|
170
185
|
- lib/fat_core/array.rb
|