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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4226717355dd1d018a8b28fb655d36760ebc2afd
4
- data.tar.gz: 69a9a6fba1a6268881fc8cb62b4e6bacb9bf481a
3
+ metadata.gz: 4c84245c5d16bd9ed1f877d85b8a4b5f3dd86c2a
4
+ data.tar.gz: 17753f85febd4ca6c1cf59f3d51b39068eaf639c
5
5
  SHA512:
6
- metadata.gz: 484d04f6e77d04a10476ae3b3f8323eda4ba0f12d0378ad9f103461b6635c40285a3d6edbbead4f9b06cf06789111eaf929909ba4f870475e215755ac0d3f25c
7
- data.tar.gz: 072820b9a27a82d34b708f7dabcc0e4537008edb278f624b49d5b202fd8cc2ebcd32e6aae036e5ed9d772e58e1199a2f741d3c3bcd58524e2cd884b90e9d3f55
6
+ metadata.gz: 855688e57b168e2de66da4113c98da40776211468c16766428aa76a090ed901eaf8681d24469ef8df0e893e2afb024f1c45967fa354dddbe0e538d3090444849
7
+ data.tar.gz: eeefdbde9edbaa48be5bb4d095d647ebb669d74d3a0411af747e0f9b361849bb81d0b9ce8076f7a252c403043883fba3a13b2e1487bfbeed6c15e83328eb62dc
@@ -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"
@@ -0,0 +1,7 @@
1
+ module CoreExtensions
2
+ module Date
3
+ module FatCore
4
+
5
+ end
6
+ end
7
+ end
@@ -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
@@ -1,7 +1,7 @@
1
1
  module FatCore
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- PATCH = 4
4
+ PATCH = 5
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
@@ -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
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-01-09 00:00:00.000000000 Z
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