xbrlware-ce 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. data/Copying.txt +13 -0
  2. data/License.txt +13 -0
  3. data/Rakefile.rb +124 -0
  4. data/Readme.txt +15 -0
  5. data/doc/classes/Edgar.html +144 -0
  6. data/doc/classes/Edgar/HTMLFeedDownloader.html +199 -0
  7. data/doc/classes/Edgar/RSSFeedDownloader.html +225 -0
  8. data/doc/classes/Xbrlware.html +350 -0
  9. data/doc/classes/Xbrlware/Context.html +429 -0
  10. data/doc/classes/Xbrlware/Entity.html +323 -0
  11. data/doc/classes/Xbrlware/Identifier.html +191 -0
  12. data/doc/classes/Xbrlware/Instance.html +742 -0
  13. data/doc/classes/Xbrlware/Item.html +278 -0
  14. data/doc/classes/Xbrlware/LBConstants.html +144 -0
  15. data/doc/classes/Xbrlware/Linkbase.html +131 -0
  16. data/doc/classes/Xbrlware/Linkbase/CalculationLinkbase.html +212 -0
  17. data/doc/classes/Xbrlware/Linkbase/CalculationLinkbase/Calculation.html +172 -0
  18. data/doc/classes/Xbrlware/Linkbase/CalculationLinkbase/Calculation/CalculationArc.html +166 -0
  19. data/doc/classes/Xbrlware/Linkbase/DefinitionLinkbase.html +210 -0
  20. data/doc/classes/Xbrlware/Linkbase/DefinitionLinkbase/Definition.html +204 -0
  21. data/doc/classes/Xbrlware/Linkbase/DefinitionLinkbase/Definition/DefinitionArc.html +160 -0
  22. data/doc/classes/Xbrlware/Linkbase/LabelLinkbase.html +239 -0
  23. data/doc/classes/Xbrlware/Linkbase/LabelLinkbase/Label.html +189 -0
  24. data/doc/classes/Xbrlware/Linkbase/Linkbase.html +172 -0
  25. data/doc/classes/Xbrlware/Linkbase/Linkbase/Link.html +217 -0
  26. data/doc/classes/Xbrlware/Linkbase/Linkbase/Link/Arc.html +284 -0
  27. data/doc/classes/Xbrlware/Linkbase/PresentationLinkbase.html +224 -0
  28. data/doc/classes/Xbrlware/Linkbase/PresentationLinkbase/Presentation.html +222 -0
  29. data/doc/classes/Xbrlware/Linkbase/PresentationLinkbase/Presentation/PresentationArc.html +160 -0
  30. data/doc/classes/Xbrlware/Taxonomy.html +369 -0
  31. data/doc/classes/Xbrlware/TaxonomyDefintion.html +177 -0
  32. data/doc/classes/Xbrlware/Unit.html +179 -0
  33. data/doc/classes/Xbrlware/Unit/Divide.html +165 -0
  34. data/doc/created.rid +1 -0
  35. data/doc/files/Readme_txt.html +124 -0
  36. data/doc/files/lib/edgar/edgar_data_downloader_rb.html +129 -0
  37. data/doc/files/lib/edgar/util_rb.html +129 -0
  38. data/doc/files/lib/edgar_rb.html +141 -0
  39. data/doc/files/lib/xbrlware/constants_rb.html +129 -0
  40. data/doc/files/lib/xbrlware/context_rb.html +129 -0
  41. data/doc/files/lib/xbrlware/date_util_rb.html +129 -0
  42. data/doc/files/lib/xbrlware/float_patch_rb.html +129 -0
  43. data/doc/files/lib/xbrlware/hash_util_rb.html +129 -0
  44. data/doc/files/lib/xbrlware/instance_rb.html +129 -0
  45. data/doc/files/lib/xbrlware/item_rb.html +129 -0
  46. data/doc/files/lib/xbrlware/linkbase/calculation_linkbase_rb.html +129 -0
  47. data/doc/files/lib/xbrlware/linkbase/definition_linkbase_rb.html +129 -0
  48. data/doc/files/lib/xbrlware/linkbase/label_linkbase_rb.html +129 -0
  49. data/doc/files/lib/xbrlware/linkbase/linkbase_rb.html +129 -0
  50. data/doc/files/lib/xbrlware/linkbase/presentation_linkbase_rb.html +129 -0
  51. data/doc/files/lib/xbrlware/meta_util_rb.html +129 -0
  52. data/doc/files/lib/xbrlware/taxonomy_rb.html +129 -0
  53. data/doc/files/lib/xbrlware/unit_rb.html +129 -0
  54. data/doc/files/lib/xbrlware/util_rb.html +129 -0
  55. data/doc/files/lib/xbrlware/xml_parser_rb.html +129 -0
  56. data/doc/files/lib/xbrlware_rb.html +163 -0
  57. data/doc/fr_class_index.html +55 -0
  58. data/doc/fr_file_index.html +48 -0
  59. data/doc/fr_method_index.html +104 -0
  60. data/doc/index.html +24 -0
  61. data/doc/rdoc-style.css +208 -0
  62. data/example/benchmark/instance_parser_benchmark.rb +25 -0
  63. data/example/case_study/buy_strategy.rb +34 -0
  64. data/example/case_study/c-20091230.xml +29 -0
  65. data/example/case_study/c_sell_strategy.rb +29 -0
  66. data/example/lang_integration/thrift/rating-client.py +21 -0
  67. data/example/lang_integration/thrift/rating-impl.rb +13 -0
  68. data/example/lang_integration/thrift/rating-server.rb +25 -0
  69. data/example/lang_integration/thrift/rating.thrift +52 -0
  70. data/example/quick_start/foo.rb +10 -0
  71. data/example/quick_start/foo.xml +29 -0
  72. data/example/quick_start/print_item.rb +27 -0
  73. data/lib/edgar.rb +30 -0
  74. data/lib/edgar/edgar_data_downloader.rb +126 -0
  75. data/lib/edgar/util.rb +30 -0
  76. data/lib/xbrlware.rb +65 -0
  77. data/lib/xbrlware/constants.rb +29 -0
  78. data/lib/xbrlware/context.rb +148 -0
  79. data/lib/xbrlware/date_util.rb +35 -0
  80. data/lib/xbrlware/float_patch.rb +26 -0
  81. data/lib/xbrlware/hash_util.rb +175 -0
  82. data/lib/xbrlware/instance.rb +406 -0
  83. data/lib/xbrlware/item.rb +115 -0
  84. data/lib/xbrlware/linkbase/calculation_linkbase.rb +137 -0
  85. data/lib/xbrlware/linkbase/definition_linkbase.rb +186 -0
  86. data/lib/xbrlware/linkbase/label_linkbase.rb +128 -0
  87. data/lib/xbrlware/linkbase/linkbase.rb +170 -0
  88. data/lib/xbrlware/linkbase/presentation_linkbase.rb +160 -0
  89. data/lib/xbrlware/meta_util.rb +45 -0
  90. data/lib/xbrlware/taxonomies/us_gaap_taxonomy_20090131.rb +40365 -0
  91. data/lib/xbrlware/taxonomy.rb +133 -0
  92. data/lib/xbrlware/unit.rb +42 -0
  93. data/lib/xbrlware/util.rb +83 -0
  94. data/lib/xbrlware/xml_parser.rb +122 -0
  95. data/setup.rb +1585 -0
  96. data/test/lib/edgar/edgar_data_downloader_test.rb +35 -0
  97. data/test/lib/edgar/resources/0000930413-09-005485-index.htm +331 -0
  98. data/test/lib/edgar/resources/usgaap.rss.xml +2861 -0
  99. data/test/lib/xbrlware/411_footnotes_test.rb +65 -0
  100. data/test/lib/xbrlware/42_schemaref_test.rb +20 -0
  101. data/test/lib/xbrlware/46_item_test.rb +253 -0
  102. data/test/lib/xbrlware/47_context_test.rb +129 -0
  103. data/test/lib/xbrlware/48_unit_test.rb +45 -0
  104. data/test/lib/xbrlware/49_tuple_test.rb +12 -0
  105. data/test/lib/xbrlware/date_util_test.rb +24 -0
  106. data/test/lib/xbrlware/dimension/context_explicit_dimension_test.rb +40 -0
  107. data/test/lib/xbrlware/dimension/resources/context_explicit_dimension.xml +84 -0
  108. data/test/lib/xbrlware/float_patch_test.rb +10 -0
  109. data/test/lib/xbrlware/hash_util_test.rb +29 -0
  110. data/test/lib/xbrlware/instance_test.rb +250 -0
  111. data/test/lib/xbrlware/linkbase/calculation_linkbase_test.rb +39 -0
  112. data/test/lib/xbrlware/linkbase/definition_linkbase_test.rb +35 -0
  113. data/test/lib/xbrlware/linkbase/label_linkbase_test.rb +22 -0
  114. data/test/lib/xbrlware/linkbase/linkbase_test.rb +36 -0
  115. data/test/lib/xbrlware/linkbase/linkbase_test_util.rb +98 -0
  116. data/test/lib/xbrlware/linkbase/presentation_linkbase_test.rb +33 -0
  117. data/test/lib/xbrlware/linkbase/report.html +62 -0
  118. data/test/lib/xbrlware/linkbase/resources/cal.xml +219 -0
  119. data/test/lib/xbrlware/linkbase/resources/def.xml +186 -0
  120. data/test/lib/xbrlware/linkbase/resources/def_with_multiple_dimension.xml +41 -0
  121. data/test/lib/xbrlware/linkbase/resources/instance.xml +5822 -0
  122. data/test/lib/xbrlware/linkbase/resources/lab.xml +782 -0
  123. data/test/lib/xbrlware/linkbase/resources/pre.xml +485 -0
  124. data/test/lib/xbrlware/linkbase/resources/report_10_q.htm +12327 -0
  125. data/test/lib/xbrlware/linkbase/resources/taxonomy.xsd +178 -0
  126. data/test/lib/xbrlware/linkbase/sample_html_report.html +40 -0
  127. data/test/lib/xbrlware/meta_util_test.rb +23 -0
  128. data/test/lib/xbrlware/resources/411/411_footnotes.xml +66 -0
  129. data/test/lib/xbrlware/resources/42/42_schema_ref_with_base.xml +7 -0
  130. data/test/lib/xbrlware/resources/42/42_schema_ref_without_base.xml +7 -0
  131. data/test/lib/xbrlware/resources/46/46_item_value.xml +61 -0
  132. data/test/lib/xbrlware/resources/47/472_period_forever.xml +29 -0
  133. data/test/lib/xbrlware/resources/47/472_period_instant.xml +24 -0
  134. data/test/lib/xbrlware/resources/47/472_period_start_dt_and_end_dt.xml +30 -0
  135. data/test/lib/xbrlware/resources/47/4731_entity_identifier.xml +29 -0
  136. data/test/lib/xbrlware/resources/47/4732_entity_segment_not_present.xml +24 -0
  137. data/test/lib/xbrlware/resources/47/4732_entity_segment_present.xml +30 -0
  138. data/test/lib/xbrlware/resources/47/474_scenario_not_present.xml +26 -0
  139. data/test/lib/xbrlware/resources/47/474_scenario_present.xml +30 -0
  140. data/test/lib/xbrlware/resources/47/47_multiple_contexts.xml +36 -0
  141. data/test/lib/xbrlware/resources/48/482_unit_measure.xml +32 -0
  142. data/test/lib/xbrlware/resources/48/483_unit_divide.xml +39 -0
  143. data/test/lib/xbrlware/resources/48/48_multiple_units.xml +43 -0
  144. data/test/lib/xbrlware/resources/49/49_tuple.xml +61 -0
  145. data/test/lib/xbrlware/resources/49_tuple.xsd +44 -0
  146. data/test/lib/xbrlware/resources/instance.xml +128 -0
  147. data/test/lib/xbrlware/resources/report_test_xbrl_files/cal.xml +219 -0
  148. data/test/lib/xbrlware/resources/report_test_xbrl_files/def.xml +186 -0
  149. data/test/lib/xbrlware/resources/report_test_xbrl_files/instance.xml +5822 -0
  150. data/test/lib/xbrlware/resources/report_test_xbrl_files/lab.xml +782 -0
  151. data/test/lib/xbrlware/resources/report_test_xbrl_files/pre.xml +485 -0
  152. data/test/lib/xbrlware/resources/report_test_xbrl_files/report/report_index.html +62 -0
  153. data/test/lib/xbrlware/resources/report_test_xbrl_files/taxonomy.xsd +178 -0
  154. data/test/lib/xbrlware/resources/taxonomy_test_files/1/cal.xml +223 -0
  155. data/test/lib/xbrlware/resources/taxonomy_test_files/1/def.xml +190 -0
  156. data/test/lib/xbrlware/resources/taxonomy_test_files/1/lab.xml +786 -0
  157. data/test/lib/xbrlware/resources/taxonomy_test_files/1/pre.xml +489 -0
  158. data/test/lib/xbrlware/resources/taxonomy_test_files/1/taxonomy.xsd +177 -0
  159. data/test/lib/xbrlware/resources/taxonomy_test_files/2/linkbases/cal.xml +223 -0
  160. data/test/lib/xbrlware/resources/taxonomy_test_files/2/linkbases/def.xml +190 -0
  161. data/test/lib/xbrlware/resources/taxonomy_test_files/2/linkbases/lab.xml +786 -0
  162. data/test/lib/xbrlware/resources/taxonomy_test_files/2/linkbases/pre.xml +489 -0
  163. data/test/lib/xbrlware/resources/taxonomy_test_files/2/taxonomy.xsd +175 -0
  164. data/test/lib/xbrlware/resources/taxonomy_test_files/3/taxonomy.xsd +175 -0
  165. data/test/lib/xbrlware/resources/us_gaap_schema.xsd +8 -0
  166. data/test/lib/xbrlware/resources/us_gaap_schema_local.xsd +10 -0
  167. data/test/lib/xbrlware/resources/util_test_xbrl_files/cal.xml +219 -0
  168. data/test/lib/xbrlware/resources/util_test_xbrl_files/def.xml +186 -0
  169. data/test/lib/xbrlware/resources/util_test_xbrl_files/instance.xml +5822 -0
  170. data/test/lib/xbrlware/resources/util_test_xbrl_files/lab.xml +782 -0
  171. data/test/lib/xbrlware/resources/util_test_xbrl_files/pre.xml +485 -0
  172. data/test/lib/xbrlware/resources/util_test_xbrl_files/taxonomy.xsd +178 -0
  173. data/test/lib/xbrlware/resources/xbrl_xsd/dei-2009-01-31.xsd +162 -0
  174. data/test/lib/xbrlware/resources/xbrl_xsd/dei-std-2009-01-31.xsd +23 -0
  175. data/test/lib/xbrlware/resources/xbrl_xsd/negated-2008-03-31.xsd +23 -0
  176. data/test/lib/xbrlware/resources/xbrl_xsd/ref-2006-02-27.xsd +121 -0
  177. data/test/lib/xbrlware/resources/xbrl_xsd/us-gaap-2009-01-31.xsd +13474 -0
  178. data/test/lib/xbrlware/resources/xbrl_xsd/us-roles-2009-01-31.xsd +2283 -0
  179. data/test/lib/xbrlware/resources/xbrl_xsd/us-types-2009-01-31.xsd +368 -0
  180. data/test/lib/xbrlware/resources/xbrl_xsd/xbrl-instance-2003-12-31.xsd +772 -0
  181. data/test/lib/xbrlware/resources/xbrl_xsd/xbrl-linkbase-2003-12-31.xsd +477 -0
  182. data/test/lib/xbrlware/resources/xbrl_xsd/xbrldi-2006.xsd +41 -0
  183. data/test/lib/xbrlware/resources/xbrl_xsd/xbrldt-2005.xsd +53 -0
  184. data/test/lib/xbrlware/resources/xbrl_xsd/xl-2003-12-31.xsd +246 -0
  185. data/test/lib/xbrlware/resources/xbrl_xsd/xlink-2003-12-31.xsd +117 -0
  186. data/test/lib/xbrlware/taxonomy_test.rb +124 -0
  187. data/test/lib/xbrlware/util_test.rb +18 -0
  188. data/test/lib/xbrlware/xml_parser_test.rb +142 -0
  189. data/test/schema_validator_jruby.rb +40 -0
  190. data/test/schema_validator_ruby.rb +7 -0
  191. data/test/scratchpad/block.rb +36 -0
  192. data/test/test_helper.rb +21 -0
  193. data/xbrlware.iml +30 -0
  194. metadata +261 -0
data/Copying.txt ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/License.txt ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/Rakefile.rb ADDED
@@ -0,0 +1,124 @@
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
+
28
+
29
+ LIBDIR = 'lib'
30
+ DOCDIR = 'doc'
31
+ TESTDIR = 'test'
32
+ EXAMPLEDIR = 'example'
33
+
34
+ # Configure some constants and built-in tasks
35
+ CURRENT_VERSION = '1.0.2'
36
+ PKG_VERSION = ENV['REL'] ? ENV['REL'] : CURRENT_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 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
data/Readme.txt ADDED
@@ -0,0 +1,15 @@
1
+ = Copyright/License Info
2
+
3
+ Copyright 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,144 @@
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>Module: Edgar</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>Module</strong></td>
53
+ <td class="class-name-in-header">Edgar</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/edgar/util_rb.html">
59
+ lib/edgar/util.rb
60
+ </a>
61
+ <br />
62
+ <a href="../files/lib/edgar/edgar_data_downloader_rb.html">
63
+ lib/edgar/edgar_data_downloader.rb
64
+ </a>
65
+ <br />
66
+ </td>
67
+ </tr>
68
+
69
+ </table>
70
+ </div>
71
+ <!-- banner header -->
72
+
73
+ <div id="bodyContent">
74
+
75
+
76
+
77
+ <div id="contextContent">
78
+
79
+ <div id="description">
80
+ <table>
81
+ <tr><td valign="top">Author:</td><td>xbrlware@bitstat.com
82
+
83
+ </td></tr>
84
+ <tr><td valign="top">Copyright:</td><td>2009, 2010 bitstat (<a href="http://www.bitstat.com">www.bitstat.com</a>).
85
+ All Rights Reserved.
86
+
87
+ </td></tr>
88
+ <tr><td valign="top">License:</td><td>Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
89
+ you may not use this file except in compliance with the License. You may
90
+ obtain a copy of the License at
91
+
92
+ <p>
93
+ <a
94
+ href="http://www.apache.org/licenses/LICENSE-2.0">www.apache.org/licenses/LICENSE-2.0</a>
95
+ </p>
96
+ <p>
97
+ Unless required by applicable law or agreed to in writing, software
98
+ distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
99
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
100
+ See the License for the specific language governing permissions and
101
+ limitations under the License.
102
+ </p>
103
+ </td></tr>
104
+ </table>
105
+
106
+ </div>
107
+
108
+
109
+ </div>
110
+
111
+
112
+ </div>
113
+
114
+
115
+ <!-- if includes -->
116
+
117
+ <div id="section">
118
+
119
+ <div id="class-list">
120
+ <h3 class="section-bar">Classes and Modules</h3>
121
+
122
+ Class <a href="Edgar/HTMLFeedDownloader.html" class="link">Edgar::HTMLFeedDownloader</a><br />
123
+ Class <a href="Edgar/RSSFeedDownloader.html" class="link">Edgar::RSSFeedDownloader</a><br />
124
+
125
+ </div>
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <!-- if method_list -->
134
+
135
+
136
+ </div>
137
+
138
+
139
+ <div id="validator-badges">
140
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
141
+ </div>
142
+
143
+ </body>
144
+ </html>
@@ -0,0 +1,199 @@
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: Edgar::HTMLFeedDownloader</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">Edgar::HTMLFeedDownloader</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/edgar/edgar_data_downloader_rb.html">
59
+ lib/edgar/edgar_data_downloader.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 method to <a
84
+ href="HTMLFeedDownloader.html#M000078">download</a> XBRL files from
85
+ SEC&#8216;s EDGAR filling url. See <a
86
+ href="http://code.google.com/p/xbrlware/wiki/ReportGeneration">report
87
+ generation xbrlware wiki</a> for how to use this class.
88
+ </p>
89
+
90
+ </div>
91
+
92
+
93
+ </div>
94
+
95
+ <div id="method-list">
96
+ <h3 class="section-bar">Methods</h3>
97
+
98
+ <div class="name-list">
99
+ <a href="#M000078">download</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+ <div id="includes">
108
+ <h3 class="section-bar">Included Modules</h3>
109
+
110
+ <div id="includes-list">
111
+ <span class="include-name">REXML::StreamListener</span>
112
+ <span class="include-name">FileUtil</span>
113
+ </div>
114
+ </div>
115
+
116
+ <div id="section">
117
+
118
+
119
+
120
+
121
+
122
+ <div id="attribute-list">
123
+ <h3 class="section-bar">Attributes</h3>
124
+
125
+ <div class="name-list">
126
+ <table>
127
+ <tr class="top-aligned-row context-row">
128
+ <td class="context-item-name">links</td>
129
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
130
+ <td class="context-item-desc"></td>
131
+ </tr>
132
+ </table>
133
+ </div>
134
+ </div>
135
+
136
+
137
+
138
+ <!-- if method_list -->
139
+ <div id="methods">
140
+ <h3 class="section-bar">Public Instance methods</h3>
141
+
142
+ <div id="method-M000078" class="method-detail">
143
+ <a name="M000078"></a>
144
+
145
+ <div class="method-heading">
146
+ <a href="#M000078" class="method-signature">
147
+ <span class="method-name">download</span><span class="method-args">(url, download_to=File.expand_path(&quot;.&quot;)+File::SEPARATOR)</span>
148
+ </a>
149
+ </div>
150
+
151
+ <div class="method-description">
152
+ <p>
153
+ Takes url and download_to (where to <a
154
+ href="HTMLFeedDownloader.html#M000078">download</a>)
155
+ </p>
156
+ <pre>
157
+ default value for download_to is current_dir
158
+ </pre>
159
+ <p><a class="source-toggle" href="#"
160
+ onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
161
+ <div class="method-source-code" id="M000078-source">
162
+ <pre>
163
+ <span class="ruby-comment cmt"># File lib/edgar/edgar_data_downloader.rb, line 92</span>
164
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">download</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">download_to</span>=<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-value str">&quot;.&quot;</span>)<span class="ruby-operator">+</span><span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">SEPARATOR</span>)
165
+ <span class="ruby-identifier">$LOG</span>.<span class="ruby-identifier">info</span> <span class="ruby-value str">&quot; Starting download of fillings from SEC url [&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">url</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;]&quot;</span>
166
+ <span class="ruby-identifier">files</span>=[]
167
+ <span class="ruby-identifier">content</span> = <span class="ruby-identifier">open</span>(<span class="ruby-identifier">url</span>).<span class="ruby-identifier">read</span>
168
+ <span class="ruby-ivar">@links</span> = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span>
169
+ <span class="ruby-identifier">uri</span>=<span class="ruby-constant">URI</span>(<span class="ruby-identifier">url</span>)
170
+ <span class="ruby-ivar">@base_path</span>=<span class="ruby-value str">&quot;&quot;</span>
171
+ <span class="ruby-ivar">@base_path</span>=(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;://&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span><span class="ruby-operator">+</span>((<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span><span class="ruby-operator">==</span><span class="ruby-value">80</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;:&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_s</span>)) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span>
172
+ <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">content</span>)
173
+ <span class="ruby-identifier">download_to</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">unless</span> <span class="ruby-identifier">download_to</span>.<span class="ruby-identifier">end_with?</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">SEPARATOR</span>)
174
+ <span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">download_to</span>)
175
+ <span class="ruby-ivar">@links</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">link</span><span class="ruby-operator">|</span>
176
+ <span class="ruby-identifier">file</span>=<span class="ruby-identifier">download_to</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">link</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;/&quot;</span>)[<span class="ruby-value">-1</span>]
177
+ <span class="ruby-identifier">dump_to_file</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">open</span>(<span class="ruby-identifier">link</span>).<span class="ruby-identifier">read</span>)
178
+ <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span>
179
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span>
180
+ <span class="ruby-identifier">files</span>
181
+ <span class="ruby-keyword kw">end</span>
182
+ </pre>
183
+ </div>
184
+ </div>
185
+ </div>
186
+
187
+
188
+ </div>
189
+
190
+
191
+ </div>
192
+
193
+
194
+ <div id="validator-badges">
195
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
196
+ </div>
197
+
198
+ </body>
199
+ </html>