xbrlware-ce 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/ReleaseNotes.txt +23 -5
  2. data/doc/classes/Edgar/RSSFeedDownloader.html +2 -2
  3. data/doc/classes/NSAware.html +135 -0
  4. data/doc/classes/Xbrlware.html +1 -6
  5. data/doc/classes/Xbrlware/Context.html +85 -78
  6. data/doc/classes/Xbrlware/Context/Period.html +49 -49
  7. data/doc/classes/Xbrlware/Entity.html +49 -49
  8. data/doc/classes/Xbrlware/Identifier.html +14 -14
  9. data/doc/classes/Xbrlware/Instance.html +173 -98
  10. data/doc/classes/Xbrlware/Item.html +62 -25
  11. data/doc/classes/Xbrlware/Linkbase/CalculationLinkbase.html +41 -3
  12. data/doc/classes/Xbrlware/Linkbase/CalculationLinkbase/Calculation.html +1 -1
  13. data/doc/classes/Xbrlware/Linkbase/CalculationLinkbase/Calculation/CalculationArc.html +1 -1
  14. data/doc/classes/Xbrlware/Linkbase/DefinitionLinkbase.html +43 -3
  15. data/doc/classes/Xbrlware/Linkbase/DefinitionLinkbase/Definition.html +2 -2
  16. data/doc/classes/Xbrlware/Linkbase/DefinitionLinkbase/Definition/DefinitionArc.html +1 -1
  17. data/doc/classes/Xbrlware/Linkbase/LabelLinkbase/Label.html +1 -1
  18. data/doc/classes/Xbrlware/Linkbase/Linkbase/Link/Arc.html +22 -7
  19. data/doc/classes/Xbrlware/Linkbase/PresentationLinkbase.html +41 -3
  20. data/doc/classes/Xbrlware/Linkbase/PresentationLinkbase/Presentation.html +2 -8
  21. data/doc/classes/Xbrlware/Linkbase/PresentationLinkbase/Presentation/PresentationArc.html +1 -1
  22. data/doc/classes/Xbrlware/Taxonomy.html +84 -51
  23. data/doc/classes/Xbrlware/TaxonomyDefintion.html +14 -14
  24. data/doc/classes/Xbrlware/Unit.html +14 -7
  25. data/doc/classes/Xbrlware/Unit/Divide.html +7 -7
  26. data/doc/created.rid +1 -1
  27. data/doc/files/lib/edgar/edgar_data_downloader_rb.html +1 -1
  28. data/doc/files/lib/edgar_rb.html +1 -1
  29. data/doc/files/lib/xbrlware/context_rb.html +1 -1
  30. data/doc/files/lib/xbrlware/instance_rb.html +1 -1
  31. data/doc/files/lib/xbrlware/item_rb.html +1 -1
  32. data/doc/files/lib/xbrlware/linkbase/calculation_linkbase_rb.html +1 -1
  33. data/doc/files/lib/xbrlware/linkbase/definition_linkbase_rb.html +1 -1
  34. data/doc/files/lib/xbrlware/linkbase/label_linkbase_rb.html +1 -1
  35. data/doc/files/lib/xbrlware/linkbase/linkbase_rb.html +1 -1
  36. data/doc/files/lib/xbrlware/linkbase/presentation_linkbase_rb.html +1 -1
  37. data/doc/files/lib/xbrlware/{report_rb.html → ns_aware_rb.html} +10 -4
  38. data/doc/files/lib/xbrlware/taxonomy_rb.html +1 -1
  39. data/doc/files/lib/xbrlware/unit_rb.html +1 -1
  40. data/doc/files/lib/xbrlware/util_rb.html +1 -1
  41. data/doc/files/lib/xbrlware/version_rb.html +1 -1
  42. data/doc/files/lib/xbrlware/xml_parser_rb.html +1 -1
  43. data/doc/files/lib/xbrlware_rb.html +3 -1
  44. data/doc/fr_class_index.html +1 -1
  45. data/doc/fr_file_index.html +1 -1
  46. data/doc/fr_method_index.html +68 -68
  47. data/doc/index.html +2 -2
  48. data/example/callb/calculation_elements.rb +33 -0
  49. data/example/callb/calculation_elements_to_table.rb +62 -0
  50. data/example/case_study/cash_analyzer.rb +27 -0
  51. data/lib/edgar/edgar_data_downloader.rb +6 -6
  52. data/lib/xbrlware.rb +2 -0
  53. data/lib/xbrlware/context.rb +2 -0
  54. data/lib/xbrlware/instance.rb +65 -26
  55. data/lib/xbrlware/item.rb +34 -26
  56. data/lib/xbrlware/linkbase/calculation_linkbase.rb +51 -7
  57. data/lib/xbrlware/linkbase/definition_linkbase.rb +42 -2
  58. data/lib/xbrlware/linkbase/label_linkbase.rb +1 -0
  59. data/lib/xbrlware/linkbase/linkbase.rb +19 -9
  60. data/lib/xbrlware/linkbase/presentation_linkbase.rb +52 -9
  61. data/lib/xbrlware/ns_aware.rb +5 -0
  62. data/lib/xbrlware/taxonomy.rb +7 -0
  63. data/lib/xbrlware/unit.rb +1 -0
  64. data/lib/xbrlware/version.rb +1 -1
  65. data/lib/xbrlware/xml_parser.rb +20 -0
  66. data/test/lib/edgar/edgar_data_downloader_test.rb +1 -1
  67. data/test/lib/edgar/resources/usgaap.rss.xml +3914 -2599
  68. data/test/lib/xbrlware/46_item_test.rb +30 -0
  69. data/test/lib/xbrlware/47_context_test.rb +16 -8
  70. data/test/lib/xbrlware/48_unit_test.rb +10 -0
  71. data/test/lib/xbrlware/instance_test.rb +156 -2
  72. data/test/lib/xbrlware/linkbase/calculation_linkbase_test.rb +5 -5
  73. data/test/lib/xbrlware/linkbase/definition_linkbase_test.rb +2 -2
  74. data/test/lib/xbrlware/linkbase/presentation_linkbase_test.rb +0 -1
  75. data/test/lib/xbrlware/taxonomy_test.rb +28 -0
  76. data/test/lib/xbrlware/xml_parser_test.rb +81 -0
  77. data/test/scratchpad/tooltip.html +10 -0
  78. data/xbrlware-ce.gemspec +2 -0
  79. metadata +36 -22
  80. data/Rakefile.rb +0 -124
  81. data/doc/classes/Xbrlware/Report.html +0 -352
  82. data/lib/xbrlware/report.rb +0 -277
  83. data/test/lib/xbrlware/resources/report_test_xbrl_files/cal.xml +0 -219
  84. data/test/lib/xbrlware/resources/report_test_xbrl_files/def.xml +0 -186
  85. data/test/lib/xbrlware/resources/report_test_xbrl_files/instance.xml +0 -5822
  86. data/test/lib/xbrlware/resources/report_test_xbrl_files/lab.xml +0 -782
  87. data/test/lib/xbrlware/resources/report_test_xbrl_files/pre.xml +0 -485
  88. data/test/lib/xbrlware/resources/report_test_xbrl_files/report/report_index.html +0 -62
  89. data/test/lib/xbrlware/resources/report_test_xbrl_files/taxonomy.xsd +0 -178
  90. data/xbrlware.iml +0 -30
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title></title>
6
+ </head>
7
+ <body>
8
+ <div title="hello">JJ</div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,2 @@
1
+ load File.dirname(__FILE__) + '/Rakefile'
2
+ gem_spec
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xbrlware-ce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 1.1.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - bitstat technologies
@@ -9,19 +15,25 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-23 00:00:00 +05:30
18
+ date: 2010-07-08 00:00:00 +05:30
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: xml-simple
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - "="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 12
23
34
  version: 1.0.12
24
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  description: |-
26
38
  A fast, lightweight framework to parse, extract information from XBRL Instance, Taxonomy and Linkbase documents.
27
39
  xbrlware understands structure and relationship among elements of XBRL documents and
@@ -36,10 +48,9 @@ extra_rdoc_files:
36
48
  - Readme.txt
37
49
  files:
38
50
  - Readme.txt
39
- - xbrlware.iml
51
+ - xbrlware-ce.gemspec
40
52
  - ReleaseNotes.txt
41
53
  - setup.rb
42
- - Rakefile.rb
43
54
  - Copying.txt
44
55
  - License.txt
45
56
  - lib/xbrlware.rb
@@ -54,11 +65,11 @@ files:
54
65
  - lib/xbrlware/linkbase/label_linkbase.rb
55
66
  - lib/xbrlware/hash_util.rb
56
67
  - lib/xbrlware/constants.rb
57
- - lib/xbrlware/report.rb
58
68
  - lib/xbrlware/instance.rb
59
69
  - lib/xbrlware/date_util.rb
60
70
  - lib/xbrlware/xml_parser.rb
61
71
  - lib/xbrlware/util.rb
72
+ - lib/xbrlware/ns_aware.rb
62
73
  - lib/xbrlware/meta_util.rb
63
74
  - lib/xbrlware/context.rb
64
75
  - lib/xbrlware/unit.rb
@@ -73,13 +84,13 @@ files:
73
84
  - doc/created.rid
74
85
  - doc/fr_file_index.html
75
86
  - doc/fr_method_index.html
87
+ - doc/classes/NSAware.html
76
88
  - doc/classes/Edgar/HTMLFeedDownloader.html
77
89
  - doc/classes/Edgar/RSSFeedDownloader.html
78
90
  - doc/classes/Xbrlware.html
79
91
  - doc/classes/CGI.html
80
92
  - doc/classes/Xbrlware/Context/Period.html
81
93
  - doc/classes/Xbrlware/LBConstants.html
82
- - doc/classes/Xbrlware/Report.html
83
94
  - doc/classes/Xbrlware/Entity.html
84
95
  - doc/classes/Xbrlware/Taxonomy.html
85
96
  - doc/classes/Xbrlware/Linkbase/DefinitionLinkbase/Definition/DefinitionArc.html
@@ -122,15 +133,16 @@ files:
122
133
  - doc/files/lib/xbrlware/xml_parser_rb.html
123
134
  - doc/files/lib/xbrlware/constants_rb.html
124
135
  - doc/files/lib/xbrlware/instance_rb.html
125
- - doc/files/lib/xbrlware/report_rb.html
126
136
  - doc/files/lib/xbrlware/date_util_rb.html
127
137
  - doc/files/lib/xbrlware/context_rb.html
128
138
  - doc/files/lib/xbrlware/cgi_patch_rb.html
129
139
  - doc/files/lib/xbrlware/unit_rb.html
140
+ - doc/files/lib/xbrlware/ns_aware_rb.html
130
141
  - doc/files/lib/xbrlware/item_rb.html
131
142
  - doc/files/lib/edgar_rb.html
132
143
  - doc/files/Readme_txt.html
133
144
  - test/scratchpad/block.rb
145
+ - test/scratchpad/tooltip.html
134
146
  - test/schema_validator_ruby.rb
135
147
  - test/lib/edgar/edgar_data_downloader_test.rb
136
148
  - test/lib/edgar/resources/usgaap.rss.xml
@@ -214,13 +226,6 @@ files:
214
226
  - test/lib/xbrlware/resources/47/474_scenario_present.xml
215
227
  - test/lib/xbrlware/resources/us_gaap_schema.xsd
216
228
  - test/lib/xbrlware/resources/49/49_tuple.xml
217
- - test/lib/xbrlware/resources/report_test_xbrl_files/pre.xml
218
- - test/lib/xbrlware/resources/report_test_xbrl_files/instance.xml
219
- - test/lib/xbrlware/resources/report_test_xbrl_files/cal.xml
220
- - test/lib/xbrlware/resources/report_test_xbrl_files/lab.xml
221
- - test/lib/xbrlware/resources/report_test_xbrl_files/taxonomy.xsd
222
- - test/lib/xbrlware/resources/report_test_xbrl_files/def.xml
223
- - test/lib/xbrlware/resources/report_test_xbrl_files/report/report_index.html
224
229
  - test/lib/xbrlware/49_tuple_test.rb
225
230
  - test/lib/xbrlware/taxonomy_test.rb
226
231
  - test/lib/xbrlware/xml_parser_test.rb
@@ -233,7 +238,10 @@ files:
233
238
  - example/case_study/c_sell_strategy.rb
234
239
  - example/case_study/buy_strategy.rb
235
240
  - example/case_study/c-20091230.xml
241
+ - example/case_study/cash_analyzer.rb
236
242
  - example/benchmark/instance_parser_benchmark.rb
243
+ - example/callb/calculation_elements.rb
244
+ - example/callb/calculation_elements_to_table.rb
237
245
  - example/lang_integration/thrift/rating-server.rb
238
246
  - example/lang_integration/thrift/rating.thrift
239
247
  - example/lang_integration/thrift/rating-client.py
@@ -249,23 +257,29 @@ rdoc_options:
249
257
  require_paths:
250
258
  - lib
251
259
  required_ruby_version: !ruby/object:Gem::Requirement
260
+ none: false
252
261
  requirements:
253
262
  - - ">="
254
263
  - !ruby/object:Gem::Version
264
+ hash: 3
265
+ segments:
266
+ - 0
255
267
  version: "0"
256
- version:
257
268
  required_rubygems_version: !ruby/object:Gem::Requirement
269
+ none: false
258
270
  requirements:
259
271
  - - ">="
260
272
  - !ruby/object:Gem::Version
273
+ hash: 3
274
+ segments:
275
+ - 0
261
276
  version: "0"
262
- version:
263
277
  requirements:
264
278
  - xml-simple v1.0.12
265
279
  rubyforge_project: xbrlware
266
- rubygems_version: 1.3.5
280
+ rubygems_version: 1.3.7
267
281
  signing_key:
268
282
  specification_version: 3
269
- summary: A fast, lightweight framework to parse, extract information from XBRL Instance, Taxonomy and Linkbase documents.
283
+ summary: A fast, lightweight framework for automation & analysis of XBRL.
270
284
  test_files: []
271
285
 
data/Rakefile.rb DELETED
@@ -1,124 +0,0 @@
1
- #!/usr/bin/ruby
2
- #
3
- # Author:: xbrlware@bitstat.com
4
- #
5
- # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved.
6
- #
7
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
- # implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
- require 'rubygems'
21
- gem 'rake'
22
-
23
- require 'rake/gempackagetask'
24
- require 'rake/clean'
25
- require 'rake/testtask'
26
- require 'rake/rdoctask'
27
- require 'xbrlware/version'
28
-
29
-
30
- LIBDIR = 'lib'
31
- DOCDIR = 'doc'
32
- TESTDIR = 'test'
33
- EXAMPLEDIR = 'example'
34
-
35
- # Configure some constants and built-in tasks
36
- PKG_VERSION = Xbrlware::VERSION
37
-
38
- COMMUNITY_EDITION = 'xbrlware-ce'
39
- PKG_NAME = ENV['EDT'] ? ENV['EDT'] : COMMUNITY_EDITION
40
-
41
- PKG_DEPENDENCY = {'xml-simple' => '= 1.0.12'}
42
-
43
- SCHEMA_VALIDATION="True"
44
- unless ENV.include?("SCHEMA_VALIDATION")
45
- ENV["SCHEMA_VALIDATION"]=SCHEMA_VALIDATION
46
- end
47
-
48
- task :default => "test"
49
-
50
-
51
- # ========================================================================
52
- # Create a task to perform the unit testing.
53
- Rake::TestTask.new(:test) do |t|
54
- t.test_files = FileList[
55
- 'test/lib/**/*_test.rb'
56
- ]
57
- t.warning = false
58
- t.verbose = false
59
- end
60
-
61
- # ========================================================================
62
- # Create a task to build the RDOC documentation tree.
63
- Rake::RDocTask.new("rdoc") do |rdoc|
64
- rdoc.rdoc_dir = DOCDIR
65
- rdoc.title = 'xbrl -- Parser library for XBRL Instance Document, Taxonomy, Linkbases'
66
- rdoc.main = 'Readme.txt'
67
- rdoc.rdoc_files.include('Readme.txt')
68
- rdoc.rdoc_files.include("#{LIBDIR}/**/*.rb")
69
- rdoc.rdoc_files.exclude("#{LIBDIR}/xbrlware/taxonomies/*.rb")
70
- end
71
-
72
- # ========================================================================
73
- # Create a task that will package the Rake software into distributable
74
- # gem files.
75
- PKG_FILES = FileList[
76
- '*.*',
77
- "#{LIBDIR}/**/*.rb",
78
- "#{DOCDIR}/**/*.*",
79
- "#{TESTDIR}/**/*.*",
80
- "#{EXAMPLEDIR}/**/*.*"
81
- ]
82
-
83
- PKG_FILES.exclude(/\._/)
84
-
85
- unless defined?(Gem)
86
- puts "Package Target requires RubyGems"
87
- else
88
- spec = Gem::Specification.new do |s|
89
-
90
- # Basic information
91
- s.name = PKG_NAME
92
- s.version = PKG_VERSION
93
- s.summary = 'A fast, lightweight framework to parse, extract information from XBRL Instance, Taxonomy and Linkbase documents.'
94
- description = s.summary +
95
- "\nxbrlware understands structure and relationship among elements of XBRL documents and" +
96
- "\ndefines a set of APIs for accessing financial & business facts, meta & other related information"+
97
- "\ndefined in XBRL documents."
98
-
99
- s.description = description
100
-
101
- # Files and dependencies
102
- s.files = PKG_FILES.to_a
103
- s.require_path = LIBDIR
104
- PKG_DEPENDENCY.each do |name, ver|
105
- s.add_dependency(name, ver)
106
- end
107
-
108
- # RDoc information
109
- s.has_rdoc = true
110
- s.extra_rdoc_files = ['Readme.txt']
111
- s.rdoc_options << '--main' << 'Readme.txt'
112
-
113
- # Metadata
114
- s.authors = ['bitstat technologies']
115
- s.email = 'xbrlware@bitstat.com'
116
- s.homepage = 'http://www.bitstat.com/xbrlware/'
117
- s.rubyforge_project = 'xbrlware'
118
- s.requirements << 'xml-simple v1.0.12'
119
- end
120
-
121
- Rake::GemPackageTask.new(spec) do |t|
122
- t.need_tar = true
123
- end
124
- end
@@ -1,352 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Xbrlware::Report</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Xbrlware::Report</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/xbrlware/report_rb.html">
59
- lib/xbrlware/report.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- This class defines methods to generate HTML reports from XBRL documents.
84
- </p>
85
-
86
- </div>
87
-
88
-
89
- </div>
90
-
91
- <div id="method-list">
92
- <h3 class="section-bar">Methods</h3>
93
-
94
- <div class="name-list">
95
- <a href="#M000030">gen</a>&nbsp;&nbsp;
96
- <a href="#M000031">gen_for</a>&nbsp;&nbsp;
97
- <a href="#M000029">new</a>&nbsp;&nbsp;
98
- </div>
99
- </div>
100
-
101
- </div>
102
-
103
-
104
- <!-- if includes -->
105
-
106
- <div id="section">
107
-
108
-
109
- <div id="constants-list">
110
- <h3 class="section-bar">Constants</h3>
111
-
112
- <div class="name-list">
113
- <table summary="Constants">
114
- <tr class="top-aligned-row context-row">
115
- <td class="context-item-name">PREF</td>
116
- <td>=</td>
117
- <td class="context-item-value">{}</td>
118
- </tr>
119
- </table>
120
- </div>
121
- </div>
122
-
123
-
124
-
125
-
126
-
127
-
128
- <!-- if method_list -->
129
- <div id="methods">
130
- <h3 class="section-bar">Public Class methods</h3>
131
-
132
- <div id="method-M000029" class="method-detail">
133
- <a name="M000029"></a>
134
-
135
- <div class="method-heading">
136
- <a href="#M000029" class="method-signature">
137
- <span class="method-name">new</span><span class="method-args">(entity_details={}, pref={})</span>
138
- </a>
139
- </div>
140
-
141
- <div class="method-description">
142
- <p><a class="source-toggle" href="#"
143
- onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
144
- <div class="method-source-code" id="M000029-source">
145
- <pre>
146
- <span class="ruby-comment cmt"># File lib/xbrlware/report.rb, line 8</span>
147
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">entity_details</span>={}, <span class="ruby-identifier">pref</span>={})
148
- <span class="ruby-constant">PREF</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">pref</span>)
149
- <span class="ruby-constant">PREF</span>[<span class="ruby-value str">&quot;ITEM_FORMAT&quot;</span>]=<span class="ruby-identifier">lambda</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">val</span><span class="ruby-operator">|</span> (<span class="ruby-constant">BigDecimal</span>(<span class="ruby-identifier">val</span>)<span class="ruby-operator">/</span><span class="ruby-value">1000000</span>).<span class="ruby-identifier">round</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">to_s</span>(<span class="ruby-value str">&quot;F&quot;</span>)} <span class="ruby-keyword kw">if</span> <span class="ruby-constant">PREF</span>[<span class="ruby-value str">&quot;ITEM_FORMAT&quot;</span>].<span class="ruby-identifier">nil?</span>
150
- <span class="ruby-constant">PREF</span>[<span class="ruby-value str">&quot;ITEM_FORMAT_DESC&quot;</span>]=<span class="ruby-value str">&quot; in millions &quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">PREF</span>[<span class="ruby-value str">&quot;ITEM_FORMAT_DESC&quot;</span>].<span class="ruby-identifier">nil?</span>
151
- <span class="ruby-constant">PREF</span>[<span class="ruby-value str">&quot;ITEM_FORMAT_EXCLUDE&quot;</span>] = [<span class="ruby-value str">&quot;EntityRegistrantName&quot;</span>, <span class="ruby-value str">&quot;EntityCentralIndexKey&quot;</span>, <span class="ruby-value str">&quot;DocumentType&quot;</span>, <span class="ruby-value str">&quot;DocumentPeriodEndDate&quot;</span>, <span class="ruby-value str">&quot;CurrentFiscalYearEndDate&quot;</span>, <span class="ruby-value str">&quot;EntityCommonStockSharesOutstanding&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-constant">PREF</span>[<span class="ruby-value str">&quot;ITEM_EXCLUDE&quot;</span>].<span class="ruby-identifier">nil?</span>
152
- <span class="ruby-ivar">@entity_details</span>=<span class="ruby-identifier">entity_details</span>
153
- <span class="ruby-keyword kw">end</span>
154
- </pre>
155
- </div>
156
- </div>
157
- </div>
158
-
159
- <h3 class="section-bar">Public Instance methods</h3>
160
-
161
- <div id="method-M000030" class="method-detail">
162
- <a name="M000030"></a>
163
-
164
- <div class="method-heading">
165
- <a href="#M000030" class="method-signature">
166
- <span class="method-name">gen</span><span class="method-args">(path_to_data_folder=&quot;.&quot;, report_for=&quot;pre|cal&quot;, report_type=&quot;html|xls|xml|json&quot;, verbose_flag=&quot;q&quot;)</span>
167
- </a>
168
- </div>
169
-
170
- <div class="method-description">
171
- <p>
172
- Takes path to folder that contains xbrl documents of entities. If the
173
- folder contains xbrl documents of single entity then HTML reports are
174
- generated for that entity. If there is need to generate reports for
175
- multiple entities then
176
- </p>
177
- <pre>
178
- 1. Create root folder
179
- 2. Create subfolder for each entity inside root folder
180
- 3. The sub folders contains xbrl documents of the entity
181
- 4. File names of xbrl documents has to be in the following convention (if files are not in the convention mentioned below, you have to use gen_for method to generate reports)
182
- calculation linkbase document must end with _cal.xml
183
- definition linkbase document must end with _def.xml
184
- presentation linkbase document must end with _pre.xml
185
- label linkbase document must end with _lab.xml
186
- taxonomy file must end with .xsd
187
- instance document must end with .xml
188
- </pre>
189
- <p>
190
- calling &quot;<a href="Report.html#M000030">gen</a>&quot; with root folder,
191
- will create reports for all entities under root folder detailed reports are
192
- stored under &quot;reports&quot; folder of the entity. If the
193
- &quot;reports&quot; doesn&#8216;t exist, it will be created. Consolidated
194
- report of all generated reports is stored under root folder with name
195
- &quot;edgar_report_index.html&quot;
196
- </p>
197
- <p><a class="source-toggle" href="#"
198
- onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
199
- <div class="method-source-code" id="M000030-source">
200
- <pre>
201
- <span class="ruby-comment cmt"># File lib/xbrlware/report.rb, line 122</span>
202
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gen</span>(<span class="ruby-identifier">path_to_data_folder</span>=<span class="ruby-value str">&quot;.&quot;</span>, <span class="ruby-identifier">report_for</span>=<span class="ruby-value str">&quot;pre|cal&quot;</span>, <span class="ruby-identifier">report_type</span>=<span class="ruby-value str">&quot;html|xls|xml|json&quot;</span>, <span class="ruby-identifier">verbose_flag</span>=<span class="ruby-value str">&quot;q&quot;</span>)
203
- <span class="ruby-ivar">@ins_report_map</span>={}
204
- <span class="ruby-identifier">files</span>=<span class="ruby-identifier">xbrl_files</span>(<span class="ruby-identifier">path_to_data_folder</span>)
205
- <span class="ruby-identifier">$LOG</span>.<span class="ruby-identifier">info</span> <span class="ruby-value str">&quot; Filtering xbrl files from folder [&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path_to_data_folder</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;] done&quot;</span>
206
- <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file_map</span><span class="ruby-operator">|</span>
207
- <span class="ruby-keyword kw">begin</span>
208
- <span class="ruby-ivar">@ins_report_map</span>[<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;ins&quot;</span>]]=<span class="ruby-identifier">gen_for</span>(<span class="ruby-identifier">file_map</span>, <span class="ruby-identifier">report_for</span>, <span class="ruby-identifier">report_type</span>, <span class="ruby-identifier">verbose_flag</span>)
209
- <span class="ruby-identifier">$LOG</span>.<span class="ruby-identifier">info</span> <span class="ruby-value str">&quot;Report generation for [&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;ins&quot;</span>]<span class="ruby-operator">+</span><span class="ruby-value str">&quot;] completed.&quot;</span>
210
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span><span class="ruby-operator">:</span>
211
- <span class="ruby-identifier">$LOG</span>.<span class="ruby-identifier">fatal</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>
212
- <span class="ruby-keyword kw">end</span>
213
- <span class="ruby-keyword kw">end</span>
214
-
215
- <span class="ruby-identifier">erb</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@@html_template</span>)
216
- <span class="ruby-identifier">index_content</span>=<span class="ruby-identifier">erb</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">get_binding</span>)
217
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-value str">&quot;master_report_index.html&quot;</span>, <span class="ruby-value str">'w'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">index_content</span>) }
218
-
219
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span><span class="ruby-operator">:</span>
220
- <span class="ruby-identifier">$LOG</span>.<span class="ruby-identifier">fatal</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>
221
- <span class="ruby-keyword kw">end</span>
222
- </pre>
223
- </div>
224
- </div>
225
- </div>
226
-
227
- <div id="method-M000031" class="method-detail">
228
- <a name="M000031"></a>
229
-
230
- <div class="method-heading">
231
- <a href="#M000031" class="method-signature">
232
- <span class="method-name">gen_for</span><span class="method-args">(file_map, report_for=&quot;pre|cal&quot;, report_type=&quot;html|xls|xml|json&quot;, verbose_flag=&quot;q&quot;, report_dir=nil, meta_gen=true)</span>
233
- </a>
234
- </div>
235
-
236
- <div class="method-description">
237
- <p>
238
- Generates HTML reports from given Hash that contains files for instance,
239
- taxonomy, calculation, presentation, label, definition. Example of
240
- populating hash,
241
- </p>
242
- <pre>
243
- files={}
244
- files[&quot;ins&quot;] = &quot;&lt;instnace_file_path&gt;&quot;
245
- files[&quot;tax&quot;] = &quot;&lt;taxonomy_file_path&gt;&quot;
246
- files[&quot;cal&quot;] = &quot;&lt;calculation_linkbase_file_path&gt;&quot;
247
- files[&quot;pre&quot;] = &quot;&lt;presentation_linkbase_file_path&gt;&quot;
248
- files[&quot;lab&quot;] = &quot;&lt;label_linkbase_file_path&gt;&quot;
249
- files[&quot;def&quot;] = &quot;&lt;definition_linkbase_file_path&gt;&quot;
250
- </pre>
251
- <p>
252
- Generated HTML reports will be stored under &quot;reports&quot; folder of
253
- current dir. If the &quot;reports&quot; doesn&#8216;t exist, it will be
254
- created. If &quot;cal&quot; is passed as null, calculation linkbase path
255
- from taxonomy will be used. Same for other linkbases too (ie,
256
- &quot;pre&quot;, &quot;lab&quot; and &quot;def&quot;.)
257
- </p>
258
- <p><a class="source-toggle" href="#"
259
- onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
260
- <div class="method-source-code" id="M000031-source">
261
- <pre>
262
- <span class="ruby-comment cmt"># File lib/xbrlware/report.rb, line 204</span>
263
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gen_for</span> (<span class="ruby-identifier">file_map</span>, <span class="ruby-identifier">report_for</span>=<span class="ruby-value str">&quot;pre|cal&quot;</span>, <span class="ruby-identifier">report_type</span>=<span class="ruby-value str">&quot;html|xls|xml|json&quot;</span>, <span class="ruby-identifier">verbose_flag</span>=<span class="ruby-value str">&quot;q&quot;</span>, <span class="ruby-identifier">report_dir</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">meta_gen</span>=<span class="ruby-keyword kw">true</span>)
264
- <span class="ruby-identifier">ins_file</span>=<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;ins&quot;</span>]
265
- <span class="ruby-identifier">tax_file</span>=<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;tax&quot;</span>]
266
- <span class="ruby-identifier">cal_file</span>=<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;cal&quot;</span>]
267
- <span class="ruby-identifier">pre_file</span>=<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;pre&quot;</span>]
268
- <span class="ruby-identifier">lab_file</span>=<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;lab&quot;</span>]
269
- <span class="ruby-identifier">def_file</span>=<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;def&quot;</span>]
270
-
271
- <span class="ruby-identifier">reports_map</span>={}
272
-
273
- <span class="ruby-identifier">instance</span>=<span class="ruby-keyword kw">nil</span>
274
- <span class="ruby-identifier">m</span>=<span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">measure</span> <span class="ruby-keyword kw">do</span>
275
- <span class="ruby-identifier">instance</span> = <span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ins_file</span>, <span class="ruby-identifier">tax_file</span>)
276
- <span class="ruby-identifier">taxonomy</span>=<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">taxonomy</span>
277
- <span class="ruby-identifier">taxonomy</span>.<span class="ruby-identifier">init_all_lb</span>(<span class="ruby-identifier">cal_file</span>, <span class="ruby-identifier">pre_file</span>, <span class="ruby-identifier">lab_file</span>, <span class="ruby-identifier">def_file</span>)
278
- <span class="ruby-keyword kw">end</span>
279
- <span class="ruby-identifier">bm</span>(<span class="ruby-value str">&quot; Initializing xbrl took&quot;</span>, <span class="ruby-identifier">m</span>)
280
-
281
- <span class="ruby-identifier">instance</span>.<span class="ruby-identifier">entity_details</span>=<span class="ruby-ivar">@entity_details</span>
282
- <span class="ruby-identifier">reports_map</span>[<span class="ruby-value str">&quot;entity_details&quot;</span>]=<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">entity_details</span>
283
- <span class="ruby-identifier">reports_map</span>[<span class="ruby-value str">&quot;instance&quot;</span>]=<span class="ruby-identifier">instance</span>
284
-
285
- <span class="ruby-identifier">report_dir</span> = (<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">ins_file</span>)) <span class="ruby-operator">+</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">Separator</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;report&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">Separator</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">report_dir</span>.<span class="ruby-identifier">nil?</span>
286
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">makedirs</span>(<span class="ruby-identifier">report_dir</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">report_dir</span>)
287
-
288
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">report_for</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/pre/</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">instance</span>.<span class="ruby-identifier">taxonomy</span>.<span class="ruby-identifier">prelb</span>.<span class="ruby-identifier">nil?</span>)
289
- <span class="ruby-identifier">links</span>=<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">taxonomy</span>.<span class="ruby-identifier">prelb</span>.<span class="ruby-identifier">presentation</span>
290
- <span class="ruby-identifier">pre_dir</span> = <span class="ruby-identifier">report_dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;pre&quot;</span>
291
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">makedirs</span>(<span class="ruby-identifier">pre_dir</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">pre_dir</span>)
292
- <span class="ruby-identifier">reports_map</span>[<span class="ruby-value str">&quot;pre&quot;</span>]=<span class="ruby-identifier">write_reports</span>(<span class="ruby-identifier">links</span>, <span class="ruby-identifier">pre_dir</span>, <span class="ruby-identifier">report_type</span>, <span class="ruby-identifier">verbose_flag</span>)
293
- <span class="ruby-keyword kw">end</span>
294
-
295
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">report_for</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/cal/</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">instance</span>.<span class="ruby-identifier">taxonomy</span>.<span class="ruby-identifier">callb</span>.<span class="ruby-identifier">nil?</span>)
296
- <span class="ruby-identifier">links</span>=<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">taxonomy</span>.<span class="ruby-identifier">callb</span>.<span class="ruby-identifier">calculation</span>
297
- <span class="ruby-identifier">cal_dir</span> = <span class="ruby-identifier">report_dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;cal&quot;</span>
298
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">makedirs</span>(<span class="ruby-identifier">cal_dir</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">cal_dir</span>)
299
- <span class="ruby-identifier">reports_map</span>[<span class="ruby-value str">&quot;cal&quot;</span>]=<span class="ruby-identifier">write_reports</span>(<span class="ruby-identifier">links</span>, <span class="ruby-identifier">cal_dir</span>, <span class="ruby-identifier">report_type</span>, <span class="ruby-identifier">verbose_flag</span>)
300
- <span class="ruby-keyword kw">end</span>
301
-
302
- <span class="ruby-identifier">_tmp</span> = <span class="ruby-ivar">@ins_report_map</span>
303
-
304
- <span class="ruby-identifier">erb</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@@html_template</span>)
305
- <span class="ruby-identifier">index_content</span>=<span class="ruby-identifier">erb</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span>
306
- <span class="ruby-ivar">@ins_report_map</span>={}
307
- <span class="ruby-ivar">@ins_report_map</span>[<span class="ruby-identifier">file_map</span>[<span class="ruby-value str">&quot;ins&quot;</span>]]=<span class="ruby-identifier">reports_map</span>
308
- <span class="ruby-identifier">lambda</span> {}
309
- <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">call</span>)
310
-
311
- <span class="ruby-ivar">@ins_report_map</span> = <span class="ruby-identifier">_tmp</span>
312
-
313
- <span class="ruby-comment cmt"># str_ci_key=reports_map[&quot;entity_details&quot;][&quot;ci_key&quot;]</span>
314
- <span class="ruby-comment cmt"># str_doc_end_date=reports_map[&quot;entity_details&quot;][&quot;doc_end_date&quot;]</span>
315
- <span class="ruby-comment cmt"># str_doc_end_date=&quot;&quot; if str_doc_end_date.nil?</span>
316
- <span class="ruby-comment cmt"># str_doc_end_date.gsub!(&quot;-&quot;, &quot;&quot;)</span>
317
- <span class="ruby-comment cmt"># report_index_file = report_dir + str_ci_key+&quot;_&quot;+str_doc_end_date+&quot;_report.html&quot;</span>
318
-
319
- <span class="ruby-identifier">report_index_file</span> = <span class="ruby-identifier">report_dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;report_index.html&quot;</span>
320
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-identifier">report_index_file</span>, <span class="ruby-value str">'w'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">index_content</span>) }
321
-
322
- <span class="ruby-identifier">reports_map</span>[<span class="ruby-value str">&quot;report_index_file&quot;</span>]=<span class="ruby-identifier">report_index_file</span>
323
-
324
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">meta_gen</span>
325
- <span class="ruby-identifier">meta_file_name</span> = <span class="ruby-identifier">report_dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;meta.json&quot;</span>
326
- <span class="ruby-identifier">meta_gen_content</span> = <span class="ruby-identifier">reports_map</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span><span class="ruby-operator">==</span><span class="ruby-value str">&quot;instance&quot;</span>}.<span class="ruby-identifier">to_json</span>.<span class="ruby-identifier">to_s</span>
327
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-identifier">meta_file_name</span>, <span class="ruby-value str">'w'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">meta_gen_content</span>) }
328
- <span class="ruby-identifier">reports_map</span>[<span class="ruby-value str">&quot;report_meta_file&quot;</span>]=<span class="ruby-identifier">meta_file_name</span>
329
- <span class="ruby-keyword kw">end</span>
330
-
331
- <span class="ruby-identifier">reports_map</span>
332
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
333
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot; Report generation failed for instance &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ins_file</span> <span class="ruby-operator">+</span> <span class="ruby-node">&quot;\n #{e.to_s + &quot;\n&quot; + e.backtrace.join(&quot;\n &quot;)}&quot;</span>
334
- <span class="ruby-keyword kw">end</span>
335
- </pre>
336
- </div>
337
- </div>
338
- </div>
339
-
340
-
341
- </div>
342
-
343
-
344
- </div>
345
-
346
-
347
- <div id="validator-badges">
348
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
349
- </div>
350
-
351
- </body>
352
- </html>