xbrlware-ruby19 1.1.2.19
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +4 -0
- data/Rakefile +2 -0
- data/lib/xbrlware-ruby19/cgi_patch.rb +58 -0
- data/lib/xbrlware-ruby19/constants.rb +29 -0
- data/lib/xbrlware-ruby19/context.rb +193 -0
- data/lib/xbrlware-ruby19/date_util.rb +45 -0
- data/lib/xbrlware-ruby19/float_patch.rb +26 -0
- data/lib/xbrlware-ruby19/hash_util.rb +175 -0
- data/lib/xbrlware-ruby19/instance.rb +475 -0
- data/lib/xbrlware-ruby19/item.rb +123 -0
- data/lib/xbrlware-ruby19/linkbase/calculation_linkbase.rb +181 -0
- data/lib/xbrlware-ruby19/linkbase/definition_linkbase.rb +226 -0
- data/lib/xbrlware-ruby19/linkbase/label_linkbase.rb +132 -0
- data/lib/xbrlware-ruby19/linkbase/linkbase.rb +193 -0
- data/lib/xbrlware-ruby19/linkbase/presentation_linkbase.rb +204 -0
- data/lib/xbrlware-ruby19/meta_util.rb +50 -0
- data/lib/xbrlware-ruby19/ns_aware.rb +5 -0
- data/lib/xbrlware-ruby19/taxonomies/ifrs_taxonomy_20090401.rb +8278 -0
- data/lib/xbrlware-ruby19/taxonomies/us_gaap_taxonomy_20090131.rb +40365 -0
- data/lib/xbrlware-ruby19/taxonomy.rb +143 -0
- data/lib/xbrlware-ruby19/unit.rb +43 -0
- data/lib/xbrlware-ruby19/util.rb +86 -0
- data/lib/xbrlware-ruby19/version.rb +22 -0
- data/lib/xbrlware-ruby19/xml_parser.rb +142 -0
- data/lib/xbrlware-ruby19.rb +73 -0
- data/xbrlware-ruby19.gemspec +27 -0
- metadata +109 -0
@@ -0,0 +1,143 @@
|
|
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
|
+
module Xbrlware
|
21
|
+
|
22
|
+
# Class to deal with taxonomy of instance file.
|
23
|
+
class Taxonomy
|
24
|
+
|
25
|
+
attr_accessor :ignore_lablb, :ignore_deflb, :ignore_prelb, :ignore_callb
|
26
|
+
|
27
|
+
# Creates a Taxonomy.
|
28
|
+
#
|
29
|
+
# taxonomy_path:: Instance taxonomy source path.
|
30
|
+
# instance:: Instance object
|
31
|
+
def initialize(taxonomy_path, instance)
|
32
|
+
@instance=instance
|
33
|
+
@taxonomy_content=nil
|
34
|
+
|
35
|
+
@taxonomy_file_basedir=nil
|
36
|
+
unless taxonomy_path.nil?
|
37
|
+
m=Benchmark.measure do
|
38
|
+
begin
|
39
|
+
@taxonomy_content=XmlParser.xml_in(taxonomy_path, {'ForceContent' => true})
|
40
|
+
rescue Exception
|
41
|
+
@taxonomy_content=XmlParser.xml_in(File.open(taxonomy_path).read.gsub("\n", ""), {'ForceContent' => true})
|
42
|
+
end
|
43
|
+
@taxonomy_file_basedir=File.dirname(taxonomy_path)+File::Separator
|
44
|
+
end
|
45
|
+
bm("Parsing [" + taxonomy_path + "] took", m)
|
46
|
+
end
|
47
|
+
|
48
|
+
@taxonomy_def_instance=TaxonomyDefintion.new
|
49
|
+
@taxonomy_content["element"].each do |element|
|
50
|
+
MetaUtil::introduce_instance_var(@taxonomy_def_instance, element["name"].gsub(/[^a-zA-Z0-9_]/, "_"), element)
|
51
|
+
end unless @taxonomy_content.nil? || @taxonomy_content["element"].nil?
|
52
|
+
|
53
|
+
@lablb, @deflb, @prelb, @callb=nil
|
54
|
+
end
|
55
|
+
|
56
|
+
# gets taxonomy definition
|
57
|
+
def definition(name)
|
58
|
+
@taxonomy_def_instance.send(name.gsub(/[^a-zA-Z0-9_]/, "_"))
|
59
|
+
end
|
60
|
+
|
61
|
+
# initialize and returns label linkbase
|
62
|
+
def lablb(file_path=nil)
|
63
|
+
return nil if ignore_lablb
|
64
|
+
file_path=linkbase_href(Xbrlware::LBConstants::LABEL) if file_path.nil? && @lablb.nil?
|
65
|
+
return @lablb if file_path.nil?
|
66
|
+
$LOG.warn(" Label linkbase already initialized. Ignoring " + file_path) unless file_path.nil? || @lablb.nil?
|
67
|
+
@lablb = Xbrlware::Linkbase::LabelLinkbase.new(file_path) if @lablb.nil? && File.exist?(file_path)
|
68
|
+
@lablb
|
69
|
+
end
|
70
|
+
|
71
|
+
# initialize and returns definition linkbase
|
72
|
+
def deflb(file_path=nil)
|
73
|
+
return nil if ignore_deflb
|
74
|
+
file_path=linkbase_href(Xbrlware::LBConstants::DEFINITION) if file_path.nil? && @deflb.nil?
|
75
|
+
return @deflb if file_path.nil?
|
76
|
+
$LOG.warn(" Definition linkbase already initialized. Ignoring " + file_path) unless file_path.nil? || @deflb.nil?
|
77
|
+
@deflb = Xbrlware::Linkbase::DefinitionLinkbase.new(file_path, lablb()) if @deflb.nil? && File.exist?(file_path)
|
78
|
+
@deflb
|
79
|
+
end
|
80
|
+
|
81
|
+
# initialize and returns presentation linkbase
|
82
|
+
def prelb(file_path=nil)
|
83
|
+
return nil if ignore_prelb
|
84
|
+
file_path=linkbase_href(Xbrlware::LBConstants::PRESENTATION) if file_path.nil? && @prelb.nil?
|
85
|
+
return @prelb if file_path.nil?
|
86
|
+
$LOG.warn(" Presentation linkbase already initialized. Ignoring " + file_path) unless file_path.nil? || @prelb.nil?
|
87
|
+
@prelb = Xbrlware::Linkbase::PresentationLinkbase.new(file_path, @instance, deflb, lablb) if @prelb.nil? && File.exist?(file_path)
|
88
|
+
@prelb
|
89
|
+
end
|
90
|
+
|
91
|
+
# initialize and returns calculation linkbase
|
92
|
+
def callb(file_path=nil)
|
93
|
+
return nil if ignore_callb
|
94
|
+
file_path=linkbase_href(Xbrlware::LBConstants::CALCULATION) if file_path.nil? && @callb.nil?
|
95
|
+
return @callb if file_path.nil?
|
96
|
+
$LOG.warn(" Calculation linkbase already initialized. Ignoring " + file_path) unless file_path.nil? || @callb.nil?
|
97
|
+
@callb = Xbrlware::Linkbase::CalculationLinkbase.new(file_path, @instance, lablb) if @callb.nil? && File.exist?(file_path)
|
98
|
+
@callb
|
99
|
+
end
|
100
|
+
|
101
|
+
# initialize all linkbases
|
102
|
+
def init_all_lb(cal_file_path=nil, pre_file_path=nil, lab_file_path=nil, def_file_path=nil)
|
103
|
+
@lablb, @deflb, @prelb, @callb=nil
|
104
|
+
lablb(lab_file_path)
|
105
|
+
deflb(def_file_path)
|
106
|
+
prelb(pre_file_path)
|
107
|
+
callb(cal_file_path)
|
108
|
+
return
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
def linkbase_href(linkbase)
|
113
|
+
begin
|
114
|
+
linkbase_refs=@taxonomy_content["annotation"][0]["appinfo"][0]["linkbaseRef"]
|
115
|
+
linkbase_refs.each do |ref|
|
116
|
+
if ref["xlink:role"]==linkbase
|
117
|
+
return @taxonomy_file_basedir + ref["xlink:href"] if ref["xml:base"].nil?
|
118
|
+
return @taxonomy_file_basedir + ref["xml:base"] + ref["xlink:href"]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
rescue Exception => e
|
122
|
+
end
|
123
|
+
nil
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
class TaxonomyDefintion
|
129
|
+
|
130
|
+
def initialize
|
131
|
+
taxonomy_module=ENV["TAXO_NAME"].to_s.sub("-", "") + ENV["TAXO_VER"].to_s
|
132
|
+
if eval("defined?(Taxonomies::#{taxonomy_module}) == 'constant' and Taxonomies::#{taxonomy_module}.class == Module")
|
133
|
+
eval("self.extend Taxonomies::#{taxonomy_module}")
|
134
|
+
else
|
135
|
+
$LOG.warn("No taxonomy found for name ["+ENV["TAXO_NAME"].to_s+"] and version ["+ENV["TAXO_VER"].to_s+"]")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def method_missing(m, *args)
|
140
|
+
nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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
|
+
module Xbrlware
|
21
|
+
# This class represents each unit in the XBRL instance file.
|
22
|
+
# Look at {delaing with instance page on xbrlware wiki}[http://code.google.com/p/xbrlware/wiki/InstanceTaxonomy] for more details.
|
23
|
+
class Unit
|
24
|
+
include NSAware
|
25
|
+
|
26
|
+
attr_reader :id, :measure
|
27
|
+
|
28
|
+
def initialize(id, measure)
|
29
|
+
@id = id
|
30
|
+
@measure=measure
|
31
|
+
end
|
32
|
+
|
33
|
+
class Divide
|
34
|
+
|
35
|
+
attr_reader :numerator, :denominator
|
36
|
+
|
37
|
+
def initialize(numerator, denominator)
|
38
|
+
@numerator=numerator
|
39
|
+
@denominator=denominator
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,86 @@
|
|
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
|
+
module Xbrlware
|
21
|
+
|
22
|
+
# Method to grep xbrl file names from given dir
|
23
|
+
# File names of xbrl documents has to be in the following convention to use this method,
|
24
|
+
# calculation linkbase document must end with _cal.xml
|
25
|
+
# definition linkbase document must end with _def.xml
|
26
|
+
# presentation linkbase document must end with _pre.xml
|
27
|
+
# label linkbase document must end with _lab.xml
|
28
|
+
# taxonomy file muse end with .xsd
|
29
|
+
def self.file_grep (dir_path=".")
|
30
|
+
|
31
|
+
taxonomy_file=nil
|
32
|
+
instance_file=nil
|
33
|
+
|
34
|
+
pre_file=nil
|
35
|
+
cal_file=nil
|
36
|
+
lab_file=nil
|
37
|
+
def_file=nil
|
38
|
+
ref_file=nil
|
39
|
+
|
40
|
+
files=Dir[dir_path+File::SEPARATOR+"*"]
|
41
|
+
|
42
|
+
files.each do |file|
|
43
|
+
case
|
44
|
+
when file.end_with?(".xsd")
|
45
|
+
taxonomy_file = file
|
46
|
+
when file.end_with?("pre.xml")
|
47
|
+
pre_file = file
|
48
|
+
when file.end_with?("cal.xml")
|
49
|
+
cal_file = file
|
50
|
+
when file.end_with?("def.xml")
|
51
|
+
def_file = file
|
52
|
+
when file.end_with?("lab.xml")
|
53
|
+
lab_file = file
|
54
|
+
when file.end_with?("ref.xml")
|
55
|
+
ref_file = file
|
56
|
+
when file.end_with?(".xml")
|
57
|
+
instance_file = file
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
{"ins" => instance_file, "tax" => taxonomy_file, "pre" => pre_file, "cal" => cal_file, "lab" => lab_file, "def" => def_file, "ref" => ref_file}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Initializes and returns an Instance.
|
65
|
+
#
|
66
|
+
# instance_string::
|
67
|
+
# XBRL Instance source. Could be one of the following:
|
68
|
+
#
|
69
|
+
# - nil: Tries to load and parse '<scriptname>.xml'.
|
70
|
+
# - filename: Tries to load and parse filename.
|
71
|
+
# - IO object: Reads from object until EOF is detected and parses result.
|
72
|
+
# - XML string: Parses string.
|
73
|
+
#
|
74
|
+
# taxonomy_string::
|
75
|
+
# optional parameter, XBRL Taxonomy source. Could be one of the following:
|
76
|
+
#
|
77
|
+
# - nil: taxonomy file specified in the instance file would be used if present.
|
78
|
+
# - filename: Tries to load and parse filename., taxonomy file specified in the instance document will be ignored
|
79
|
+
# - IO object: Reads from object until EOF is detected and parses result, taxonomy file specified in the instance document will be ignored
|
80
|
+
# - XML string: Parses string, taxonomy file specified in the instance document will be ignored
|
81
|
+
#
|
82
|
+
def self.ins(instance_string, taxonomy_string=nil)
|
83
|
+
Instance.new(instance_string, taxonomy_string=nil)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,22 @@
|
|
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
|
+
module Xbrlware
|
21
|
+
VERSION = "1.1.2.19"
|
22
|
+
end
|
@@ -0,0 +1,142 @@
|
|
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
|
+
module Xbrlware
|
21
|
+
# Method node_to_text, collapse of XmlSimple patched to bypass entity replacement.
|
22
|
+
# XmlSimple does entity replacement (XmlSimple depends on REXML which does entity replacement
|
23
|
+
# whenever node.valus is called. see http://www.germane-software.com/software/rexml/docs/tutorial.html under "Entity Replacement")
|
24
|
+
# to check an element is a text element or not. This is causing an issue, because XBRL document has large chuck of
|
25
|
+
# HTML content as part of their text node. These HTML contents are escaped (eg, '<' to <), and XmlSimple treat them
|
26
|
+
# as entities tobe replaced with actual value. This was causing huge performance degradation. Hence two methods node_to_text
|
27
|
+
# and collapse of XmlSimple is patched to bypass entity replacement.
|
28
|
+
class XmlParser < XmlSimple # :nodoc:
|
29
|
+
|
30
|
+
# Converts a document node into a String.
|
31
|
+
# If the node could not be converted into a String
|
32
|
+
# for any reason, default will be returned.
|
33
|
+
#
|
34
|
+
# node::
|
35
|
+
# Document node to be converted.
|
36
|
+
# default::
|
37
|
+
# Value to be returned, if node could not be converted.
|
38
|
+
def node_to_text(node, default = nil)
|
39
|
+
if node.instance_of?(REXML::Element)
|
40
|
+
node.texts.map { |t| CGI::unescapeHTML(t.to_s) }.join('')
|
41
|
+
elsif node.instance_of?(REXML::Attribute)
|
42
|
+
node.value.nil? ? default : node.value.strip
|
43
|
+
elsif node.instance_of?(REXML::Text)
|
44
|
+
CGI::unescapeHTML(node.to_s).strip
|
45
|
+
else
|
46
|
+
default
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def XmlParser.xml_in(string = nil, options = nil)
|
51
|
+
xml_parser = XmlParser.new
|
52
|
+
xml_parser.xml_in(string, options)
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
# Patch to xml-simple
|
57
|
+
def has_text?(element)
|
58
|
+
rv = element.get_text
|
59
|
+
return (not rv.nil?)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Converts the attributes array of a document node into a Hash.
|
63
|
+
# Adds two attributes (nspace and nspace_prefix) to all elements.
|
64
|
+
# if any attribute exist with above name, it will be overridden
|
65
|
+
#
|
66
|
+
# node::
|
67
|
+
# Document node to extract attributes from.
|
68
|
+
def get_attributes(node)
|
69
|
+
attributes = {}
|
70
|
+
if @options['attrprefix']
|
71
|
+
node.attributes.each { |n, v| attributes["@" + n] = v }
|
72
|
+
attributes["@nspace"]=node.namespace
|
73
|
+
attributes["@nspace_prefix"]=node.prefix
|
74
|
+
else
|
75
|
+
node.attributes.each { |n, v| attributes[n] = v }
|
76
|
+
attributes["nspace"]=node.namespace
|
77
|
+
attributes["nspace_prefix"]=node.prefix
|
78
|
+
end
|
79
|
+
attributes
|
80
|
+
end
|
81
|
+
|
82
|
+
public
|
83
|
+
# Actually converts an XML document element into a data structure.
|
84
|
+
#
|
85
|
+
# element::
|
86
|
+
# The document element to be collapsed.
|
87
|
+
def collapse(element)
|
88
|
+
result = @options['noattr'] ? {} : get_attributes(element)
|
89
|
+
|
90
|
+
if @options['normalisespace'] == 2
|
91
|
+
result.each { |k, v| result[k] = normalise_space(v) }
|
92
|
+
end
|
93
|
+
|
94
|
+
if element.has_elements?
|
95
|
+
element.each_element { |child|
|
96
|
+
value = collapse(child)
|
97
|
+
if empty(value) && (element.attributes.empty? || @options['noattr'])
|
98
|
+
next if @options.has_key?('suppressempty') && @options['suppressempty'] == true
|
99
|
+
end
|
100
|
+
result = merge(result, child.name, value)
|
101
|
+
}
|
102
|
+
if has_mixed_content?(element)
|
103
|
+
# normalisespace?
|
104
|
+
content = element.texts.map { |x| x.to_s }
|
105
|
+
content = content[0] if content.size == 1
|
106
|
+
result[@options['contentkey']] = content
|
107
|
+
end
|
108
|
+
elsif has_text?(element) # i.e. it has only text.
|
109
|
+
return collapse_text_node(result, element)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Turn Arrays into Hashes if key fields present.
|
113
|
+
count = fold_arrays(result)
|
114
|
+
|
115
|
+
# Disintermediate grouped tags.
|
116
|
+
if @options.has_key?('grouptags')
|
117
|
+
result.each { |key, value|
|
118
|
+
next unless (value.instance_of?(Hash) && (value.size == 1))
|
119
|
+
child_key, child_value = value.to_a[0]
|
120
|
+
if @options['grouptags'][key] == child_key
|
121
|
+
result[key] = child_value
|
122
|
+
end
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
# Fold Hashes containing a single anonymous Array up into just the Array.
|
127
|
+
if count == 1
|
128
|
+
anonymoustag = @options['anonymoustag']
|
129
|
+
if result.has_key?(anonymoustag) && result[anonymoustag].instance_of?(Array)
|
130
|
+
return result[anonymoustag]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
if result.empty? && @options.has_key?('suppressempty')
|
135
|
+
return @options['suppressempty'] == '' ? '' : nil
|
136
|
+
end
|
137
|
+
|
138
|
+
result
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,73 @@
|
|
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 'xml-simple'#, '= 1.0.12'
|
22
|
+
require 'xmlsimple'
|
23
|
+
|
24
|
+
require 'date'
|
25
|
+
require 'bigdecimal'
|
26
|
+
require 'erb'
|
27
|
+
require 'set'
|
28
|
+
require "stringio"
|
29
|
+
require 'cgi'
|
30
|
+
|
31
|
+
require 'xbrlware-ruby19/version'
|
32
|
+
require 'xbrlware-ruby19/float_patch'
|
33
|
+
require 'xbrlware-ruby19/cgi_patch'
|
34
|
+
require 'xbrlware-ruby19/meta_util'
|
35
|
+
require 'xbrlware-ruby19/hash_util'
|
36
|
+
require 'xbrlware-ruby19/date_util'
|
37
|
+
require 'xbrlware-ruby19/xml_parser'
|
38
|
+
|
39
|
+
require 'xbrlware-ruby19/constants'
|
40
|
+
require 'xbrlware-ruby19/util'
|
41
|
+
|
42
|
+
require 'xbrlware-ruby19/taxonomies/us_gaap_taxonomy_20090131'
|
43
|
+
|
44
|
+
module Xbrlware; module Taxonomies
|
45
|
+
autoload :IFRS20090401, 'xbrlware-ruby19/taxonomies/ifrs_taxonomy_20090401'
|
46
|
+
end; end;
|
47
|
+
|
48
|
+
require 'xbrlware-ruby19/taxonomy'
|
49
|
+
|
50
|
+
require 'xbrlware-ruby19/ns_aware'
|
51
|
+
require 'xbrlware-ruby19/context'
|
52
|
+
require 'xbrlware-ruby19/instance'
|
53
|
+
require 'xbrlware-ruby19/unit'
|
54
|
+
require 'xbrlware-ruby19/item'
|
55
|
+
|
56
|
+
require 'xbrlware-ruby19/linkbase/linkbase'
|
57
|
+
require 'xbrlware-ruby19/linkbase/label_linkbase'
|
58
|
+
require 'xbrlware-ruby19/linkbase/calculation_linkbase'
|
59
|
+
require 'xbrlware-ruby19/linkbase/definition_linkbase'
|
60
|
+
require 'xbrlware-ruby19/linkbase/presentation_linkbase'
|
61
|
+
|
62
|
+
require 'logger'
|
63
|
+
require 'benchmark'
|
64
|
+
|
65
|
+
ENV["TAXO_NAME"]="US-GAAP"
|
66
|
+
ENV["TAXO_VER"]="20090131"
|
67
|
+
|
68
|
+
$LOG = Logger.new($stdout)
|
69
|
+
$LOG.level = Logger::INFO
|
70
|
+
|
71
|
+
def bm(title, measure) # :nodoc:
|
72
|
+
$LOG.debug title +" [ u :"+measure.utime.to_s+", s :"+measure.stime.to_s+", t :"+measure.total.to_s+", r :"+measure.real.to_s+"]"
|
73
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/xbrlware-ruby19/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Jim Lindstrom"]
|
6
|
+
gem.email = ["jim.lindstrom@gmail.com"]
|
7
|
+
gem.description = %q{Re-packaging of xbrlware for ruby19}
|
8
|
+
gem.summary = %q{Re-packaging of xbrlware for ruby19}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.add_dependency 'xml-simple'
|
12
|
+
#gem.add_dependency 'date'
|
13
|
+
gem.add_dependency 'bigdecimal'
|
14
|
+
#gem.add_dependency 'erb'
|
15
|
+
#gem.add_dependency 'set'
|
16
|
+
#gem.add_dependency 'stringio'
|
17
|
+
#gem.add_dependency 'cgi'
|
18
|
+
gem.add_dependency 'logger'
|
19
|
+
#gem.add_dependency 'benchmark'
|
20
|
+
|
21
|
+
gem.files = `git ls-files`.split($\)
|
22
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
23
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
24
|
+
gem.name = "xbrlware-ruby19"
|
25
|
+
gem.require_paths = ["lib"]
|
26
|
+
gem.version = Xbrlware::VERSION
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xbrlware-ruby19
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.2.19
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jim Lindstrom
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-31 00:00:00.000000000 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: xml-simple
|
17
|
+
requirement: &75044680 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *75044680
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bigdecimal
|
28
|
+
requirement: &75044470 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *75044470
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: logger
|
39
|
+
requirement: &75044260 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *75044260
|
48
|
+
description: Re-packaging of xbrlware for ruby19
|
49
|
+
email:
|
50
|
+
- jim.lindstrom@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- lib/xbrlware-ruby19.rb
|
61
|
+
- lib/xbrlware-ruby19/cgi_patch.rb
|
62
|
+
- lib/xbrlware-ruby19/constants.rb
|
63
|
+
- lib/xbrlware-ruby19/context.rb
|
64
|
+
- lib/xbrlware-ruby19/date_util.rb
|
65
|
+
- lib/xbrlware-ruby19/float_patch.rb
|
66
|
+
- lib/xbrlware-ruby19/hash_util.rb
|
67
|
+
- lib/xbrlware-ruby19/instance.rb
|
68
|
+
- lib/xbrlware-ruby19/item.rb
|
69
|
+
- lib/xbrlware-ruby19/linkbase/calculation_linkbase.rb
|
70
|
+
- lib/xbrlware-ruby19/linkbase/definition_linkbase.rb
|
71
|
+
- lib/xbrlware-ruby19/linkbase/label_linkbase.rb
|
72
|
+
- lib/xbrlware-ruby19/linkbase/linkbase.rb
|
73
|
+
- lib/xbrlware-ruby19/linkbase/presentation_linkbase.rb
|
74
|
+
- lib/xbrlware-ruby19/meta_util.rb
|
75
|
+
- lib/xbrlware-ruby19/ns_aware.rb
|
76
|
+
- lib/xbrlware-ruby19/taxonomies/ifrs_taxonomy_20090401.rb
|
77
|
+
- lib/xbrlware-ruby19/taxonomies/us_gaap_taxonomy_20090131.rb
|
78
|
+
- lib/xbrlware-ruby19/taxonomy.rb
|
79
|
+
- lib/xbrlware-ruby19/unit.rb
|
80
|
+
- lib/xbrlware-ruby19/util.rb
|
81
|
+
- lib/xbrlware-ruby19/version.rb
|
82
|
+
- lib/xbrlware-ruby19/xml_parser.rb
|
83
|
+
- xbrlware-ruby19.gemspec
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: ''
|
86
|
+
licenses: []
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.6.2
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: Re-packaging of xbrlware for ruby19
|
109
|
+
test_files: []
|