litexbrl 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +40 -0
- data/README.md +1 -1
- data/bin/litexbrl +4 -15
- data/bin/rspec +29 -0
- data/lib/litexbrl/tdnet/account_item.rb +11 -0
- data/lib/litexbrl/tdnet/cash_flow2.rb +107 -0
- data/lib/litexbrl/tdnet/summary2.rb +17 -2
- data/lib/litexbrl/tdnet/summary_attribute.rb +12 -1
- data/lib/litexbrl/tdnet.rb +8 -2
- data/lib/litexbrl/version.rb +1 -1
- data/litexbrl.gemspec +4 -0
- data/spec/data/tdnet/cash_flow2/ifrs_q4.htm +2 -0
- data/spec/data/tdnet/cash_flow2/jp_q3.htm +2 -0
- data/spec/data/tdnet/cash_flow2/jp_q4.htm +2 -0
- data/spec/data/tdnet/summary2/us-cashflow.htm +2 -0
- data/spec/tdnet/cash_flow2_spec.rb +60 -0
- data/spec/tdnet/summary2_spec.rb +88 -56
- data/spec/tdnet_spec.rb +5 -5
- metadata +45 -4
- data/circle.yml +0 -6
data/spec/tdnet/summary2_spec.rb
CHANGED
@@ -30,11 +30,14 @@ module LiteXBRL
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe ".read" do
|
33
|
+
let(:xbrl) { Summary2.read doc("#{dir}/#{file}") }
|
34
|
+
let(:summary) { xbrl[:summary] }
|
35
|
+
let(:results_forecast) { xbrl[:results_forecast].first }
|
36
|
+
let(:cash_flow) { xbrl[:cash_flow] }
|
37
|
+
|
33
38
|
context '日本会計基準' do
|
34
39
|
context "連結・第1四半期" do
|
35
|
-
let(:
|
36
|
-
let(:summary) { xbrl[:summary] }
|
37
|
-
let(:results_forecast) { xbrl[:results_forecast].first }
|
40
|
+
let(:file) { "jp-cons-2014-q1.htm" }
|
38
41
|
|
39
42
|
it do
|
40
43
|
expect(summary[:code]).to eq('3046')
|
@@ -84,9 +87,7 @@ module LiteXBRL
|
|
84
87
|
end
|
85
88
|
|
86
89
|
context '1株当たり純資産・自己株式なし' do
|
87
|
-
let(:
|
88
|
-
let(:summary) { xbrl[:summary] }
|
89
|
-
let(:results_forecast) { xbrl[:results_forecast].first }
|
90
|
+
let(:file) { "no-treasury_stock.htm" }
|
90
91
|
|
91
92
|
it { expect(summary[:net_assets_per_share]).to eq(468.85) }
|
92
93
|
end
|
@@ -95,6 +96,7 @@ module LiteXBRL
|
|
95
96
|
let(:xbrl) { Summary2.read doc("#{dir}/jp-cons-2013-q4.htm") }
|
96
97
|
let(:summary) { xbrl[:summary] }
|
97
98
|
let(:results_forecast) { xbrl[:results_forecast].first }
|
99
|
+
let(:cash_flow) { xbrl[:cash_flow] }
|
98
100
|
|
99
101
|
it do
|
100
102
|
expect(summary[:code]).to eq('2408')
|
@@ -140,15 +142,29 @@ module LiteXBRL
|
|
140
142
|
expect(results_forecast[:change_in_forecast_operating_income]).to eq(-0.329)
|
141
143
|
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq(-0.354)
|
142
144
|
expect(results_forecast[:change_in_forecast_net_income]).to eq(-0.359)
|
145
|
+
|
146
|
+
expect(cash_flow[:cash_flows_from_operating_activities]).to eq 616
|
147
|
+
expect(cash_flow[:cash_flows_from_investing_activities]).to eq -135
|
148
|
+
expect(cash_flow[:cash_flows_from_financing_activities]).to eq -64
|
149
|
+
expect(cash_flow[:cash_and_equivalents_end_of_period]).to eq 4832
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context "非連結・第4四半期" do
|
154
|
+
let(:file) { "jp-noncons-2014-q4.htm" }
|
155
|
+
|
156
|
+
it do
|
157
|
+
expect(cash_flow[:cash_flows_from_operating_activities]).to eq 6882
|
158
|
+
expect(cash_flow[:cash_flows_from_investing_activities]).to eq 828
|
159
|
+
expect(cash_flow[:cash_flows_from_financing_activities]).to eq -5361
|
160
|
+
expect(cash_flow[:cash_and_equivalents_end_of_period]).to eq 7863
|
143
161
|
end
|
144
162
|
end
|
145
163
|
end
|
146
164
|
|
147
165
|
context '米国会計基準' do
|
148
166
|
context "連結・第4四半期" do
|
149
|
-
let(:
|
150
|
-
let(:summary) { xbrl[:summary] }
|
151
|
-
let(:results_forecast) { xbrl[:results_forecast].first }
|
167
|
+
let(:file) { "us-cons-2014-q4.htm" }
|
152
168
|
|
153
169
|
it do
|
154
170
|
expect(summary[:code]).to eq '7203'
|
@@ -194,59 +210,75 @@ module LiteXBRL
|
|
194
210
|
expect(results_forecast[:change_in_forecast_operating_income]).to eq 0.003
|
195
211
|
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq -0.021
|
196
212
|
expect(results_forecast[:change_in_forecast_net_income]).to eq -0.024
|
213
|
+
|
214
|
+
expect(cash_flow[:cash_flows_from_operating_activities]).to eq 3646035
|
215
|
+
expect(cash_flow[:cash_flows_from_investing_activities]).to eq -4336248
|
216
|
+
expect(cash_flow[:cash_flows_from_financing_activities]).to eq 919480
|
217
|
+
expect(cash_flow[:cash_and_equivalents_end_of_period]).to eq 2041170
|
197
218
|
end
|
198
219
|
end
|
220
|
+
|
221
|
+
context "CashAndEquivalentsEndOfPeriod1US" do
|
222
|
+
let(:file) { "us-cashflow.htm" }
|
223
|
+
|
224
|
+
it { expect(cash_flow[:cash_and_equivalents_end_of_period]).to eq 335174 }
|
225
|
+
end
|
199
226
|
end
|
200
227
|
|
201
228
|
context 'IFRS' do
|
202
|
-
|
203
|
-
|
204
|
-
let(:results_forecast) { xbrl[:results_forecast].first }
|
229
|
+
context "連結・第4四半期" do
|
230
|
+
let(:file) { "ifrs-cons-2013-q4.htm" }
|
205
231
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
# expect(xbrl.change_in_prior_net_sales).to eq(0.008)
|
231
|
-
# expect(xbrl.change_in_prior_operating_income).to eq(0.036)
|
232
|
-
# expect(xbrl.change_in_prior_ordinary_income).to eq(0.039)
|
233
|
-
# expect(xbrl.change_in_prior_net_income).to eq(0.287)
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
232
|
+
it do
|
233
|
+
expect(summary[:code]).to eq('8923')
|
234
|
+
expect(summary[:year]).to eq(2013)
|
235
|
+
expect(summary[:month]).to eq(11)
|
236
|
+
expect(summary[:quarter]).to eq(4)
|
237
|
+
expect(summary[:consolidation]).to eq(1)
|
238
|
+
|
239
|
+
expect(summary[:net_sales]).to eq(35070)
|
240
|
+
expect(summary[:operating_income]).to eq(3909)
|
241
|
+
expect(summary[:ordinary_income]).to eq(3217)
|
242
|
+
expect(summary[:net_income]).to eq(2003)
|
243
|
+
expect(summary[:net_income_per_share]).to eq(42.99)
|
244
|
+
|
245
|
+
expect(summary[:change_in_net_sales]).to eq(0.449)
|
246
|
+
expect(summary[:change_in_operating_income]).to eq(0.369)
|
247
|
+
expect(summary[:change_in_ordinary_income]).to eq(0.45)
|
248
|
+
expect(summary[:change_in_net_income]).to eq(0.367)
|
249
|
+
|
250
|
+
expect(summary[:prior_net_sales]).to eq(24195)
|
251
|
+
expect(summary[:prior_operating_income]).to eq(2856)
|
252
|
+
expect(summary[:prior_ordinary_income]).to eq(2218)
|
253
|
+
expect(summary[:prior_net_income]).to eq(1465)
|
254
|
+
expect(summary[:prior_net_income_per_share]).to eq(32.07)
|
255
|
+
|
256
|
+
# expect(xbrl.change_in_prior_net_sales).to eq(0.008)
|
257
|
+
# expect(xbrl.change_in_prior_operating_income).to eq(0.036)
|
258
|
+
# expect(xbrl.change_in_prior_ordinary_income).to eq(0.039)
|
259
|
+
# expect(xbrl.change_in_prior_net_income).to eq(0.287)
|
260
|
+
|
261
|
+
expect(summary[:owners_equity]).to eq (30102)
|
262
|
+
expect(summary[:number_of_shares]).to eq (48284000)
|
263
|
+
expect(summary[:number_of_treasury_stock]).to be_nil
|
264
|
+
expect(summary[:net_assets_per_share]).to eq(623.45)
|
265
|
+
|
266
|
+
expect(results_forecast[:forecast_net_sales]).to eq(41817)
|
267
|
+
expect(results_forecast[:forecast_operating_income]).to eq(4618)
|
268
|
+
expect(results_forecast[:forecast_ordinary_income]).to eq(3800)
|
269
|
+
expect(results_forecast[:forecast_net_income]).to eq(2309)
|
270
|
+
expect(results_forecast[:forecast_net_income_per_share]).to eq(47.82)
|
271
|
+
|
272
|
+
expect(results_forecast[:change_in_forecast_net_sales]).to eq(0.192)
|
273
|
+
expect(results_forecast[:change_in_forecast_operating_income]).to eq(0.181)
|
274
|
+
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq(0.181)
|
275
|
+
expect(results_forecast[:change_in_forecast_net_income]).to eq(0.153)
|
276
|
+
|
277
|
+
expect(cash_flow[:cash_flows_from_operating_activities]).to eq 2772
|
278
|
+
expect(cash_flow[:cash_flows_from_investing_activities]).to eq -940
|
279
|
+
expect(cash_flow[:cash_flows_from_financing_activities]).to eq 3456
|
280
|
+
expect(cash_flow[:cash_and_equivalents_end_of_period]).to eq 14711
|
281
|
+
end
|
250
282
|
end
|
251
283
|
end
|
252
284
|
|
data/spec/tdnet_spec.rb
CHANGED
@@ -7,31 +7,31 @@ module LiteXBRL
|
|
7
7
|
|
8
8
|
let(:dir) { File.expand_path '../data/tdnet', __FILE__ }
|
9
9
|
|
10
|
-
describe '.
|
10
|
+
describe '.find_reader' do
|
11
11
|
context 'Summary' do
|
12
12
|
it do
|
13
|
-
document = TDnet.send :
|
13
|
+
document = TDnet.send :find_reader, doc("#{dir}/summary.xbrl")
|
14
14
|
expect(document).to eq(LiteXBRL::TDnet::Summary)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'Summary2' do
|
19
19
|
it do
|
20
|
-
document = TDnet.send :
|
20
|
+
document = TDnet.send :find_reader, doc("#{dir}/summary2.htm")
|
21
21
|
expect(document).to eq(LiteXBRL::TDnet::Summary2)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'ResultsForecast' do
|
26
26
|
it do
|
27
|
-
document = TDnet.send :
|
27
|
+
document = TDnet.send :find_reader, doc("#{dir}/results_forecast.xbrl")
|
28
28
|
expect(document).to eq(LiteXBRL::TDnet::ResultsForecast)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'ResultsForecast2' do
|
33
33
|
it do
|
34
|
-
document = TDnet.send :
|
34
|
+
document = TDnet.send :find_reader, doc("#{dir}/results_forecast2.htm")
|
35
35
|
expect(document).to eq(LiteXBRL::TDnet::ResultsForecast2)
|
36
36
|
end
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: litexbrl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takehiko Shinkura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -94,14 +94,44 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: awesome_print
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec_junit_formatter
|
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'
|
97
125
|
description: XBRL parser for Ruby
|
98
126
|
email:
|
99
127
|
- tynmarket@gmail.com
|
100
128
|
executables:
|
101
129
|
- litexbrl
|
130
|
+
- rspec
|
102
131
|
extensions: []
|
103
132
|
extra_rdoc_files: []
|
104
133
|
files:
|
134
|
+
- ".circleci/config.yml"
|
105
135
|
- ".gitattributes"
|
106
136
|
- ".gitignore"
|
107
137
|
- ".rspec"
|
@@ -112,10 +142,11 @@ files:
|
|
112
142
|
- Rakefile
|
113
143
|
- TODO.txt
|
114
144
|
- bin/litexbrl
|
115
|
-
-
|
145
|
+
- bin/rspec
|
116
146
|
- lib/litexbrl.rb
|
117
147
|
- lib/litexbrl/tdnet.rb
|
118
148
|
- lib/litexbrl/tdnet/account_item.rb
|
149
|
+
- lib/litexbrl/tdnet/cash_flow2.rb
|
119
150
|
- lib/litexbrl/tdnet/company_attribute.rb
|
120
151
|
- lib/litexbrl/tdnet/financial_information.rb
|
121
152
|
- lib/litexbrl/tdnet/financial_information2.rb
|
@@ -128,6 +159,9 @@ files:
|
|
128
159
|
- lib/litexbrl/utils.rb
|
129
160
|
- lib/litexbrl/version.rb
|
130
161
|
- litexbrl.gemspec
|
162
|
+
- spec/data/tdnet/cash_flow2/ifrs_q4.htm
|
163
|
+
- spec/data/tdnet/cash_flow2/jp_q3.htm
|
164
|
+
- spec/data/tdnet/cash_flow2/jp_q4.htm
|
131
165
|
- spec/data/tdnet/results_forecast.xbrl
|
132
166
|
- spec/data/tdnet/results_forecast/find_consolidation.xbrl
|
133
167
|
- spec/data/tdnet/results_forecast/ifrs-cons-2014.xbrl
|
@@ -182,11 +216,13 @@ files:
|
|
182
216
|
- spec/data/tdnet/summary2/no-treasury_stock.htm
|
183
217
|
- spec/data/tdnet/summary2/profit_attributable_to_owners_of_parent.htm
|
184
218
|
- spec/data/tdnet/summary2/revenue_ifrs.htm
|
219
|
+
- spec/data/tdnet/summary2/us-cashflow.htm
|
185
220
|
- spec/data/tdnet/summary2/us-cons-2014-q4.htm
|
186
221
|
- spec/litexbrl_spec.rb
|
187
222
|
- spec/spec_helper.rb
|
188
223
|
- spec/support/nokogiri_helper.rb
|
189
224
|
- spec/tdnet/account_item_spec.rb
|
225
|
+
- spec/tdnet/cash_flow2_spec.rb
|
190
226
|
- spec/tdnet/company_attribute_spec.rb
|
191
227
|
- spec/tdnet/results_forecast2_spec.rb
|
192
228
|
- spec/tdnet/results_forecast_attribute_spec.rb
|
@@ -208,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
244
|
requirements:
|
209
245
|
- - ">="
|
210
246
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
247
|
+
version: 2.3.0
|
212
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
249
|
requirements:
|
214
250
|
- - ">="
|
@@ -221,6 +257,9 @@ signing_key:
|
|
221
257
|
specification_version: 4
|
222
258
|
summary: XBRL parser for Ruby
|
223
259
|
test_files:
|
260
|
+
- spec/data/tdnet/cash_flow2/ifrs_q4.htm
|
261
|
+
- spec/data/tdnet/cash_flow2/jp_q3.htm
|
262
|
+
- spec/data/tdnet/cash_flow2/jp_q4.htm
|
224
263
|
- spec/data/tdnet/results_forecast.xbrl
|
225
264
|
- spec/data/tdnet/results_forecast/find_consolidation.xbrl
|
226
265
|
- spec/data/tdnet/results_forecast/ifrs-cons-2014.xbrl
|
@@ -275,11 +314,13 @@ test_files:
|
|
275
314
|
- spec/data/tdnet/summary2/no-treasury_stock.htm
|
276
315
|
- spec/data/tdnet/summary2/profit_attributable_to_owners_of_parent.htm
|
277
316
|
- spec/data/tdnet/summary2/revenue_ifrs.htm
|
317
|
+
- spec/data/tdnet/summary2/us-cashflow.htm
|
278
318
|
- spec/data/tdnet/summary2/us-cons-2014-q4.htm
|
279
319
|
- spec/litexbrl_spec.rb
|
280
320
|
- spec/spec_helper.rb
|
281
321
|
- spec/support/nokogiri_helper.rb
|
282
322
|
- spec/tdnet/account_item_spec.rb
|
323
|
+
- spec/tdnet/cash_flow2_spec.rb
|
283
324
|
- spec/tdnet/company_attribute_spec.rb
|
284
325
|
- spec/tdnet/results_forecast2_spec.rb
|
285
326
|
- spec/tdnet/results_forecast_attribute_spec.rb
|