xbrlware-extras 1.1.2.19.2 → 1.1.2.19.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/xbrlware-extras/linkbase.rb +104 -25
- data/lib/xbrlware-extras/version.rb +1 -1
- metadata +18 -10
data/.gitignore
CHANGED
@@ -25,7 +25,10 @@ module Xbrlware
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def is_disclosure?
|
28
|
-
@title.downcase =~ /^disclosure/
|
28
|
+
return true if @title.downcase =~ /^disclosure/
|
29
|
+
return true if @title.downcase =~ /^summary of/
|
30
|
+
return true if @title.downcase =~ /details$/
|
31
|
+
return false
|
29
32
|
end
|
30
33
|
|
31
34
|
def top_level_arcs
|
@@ -39,13 +42,34 @@ module Xbrlware
|
|
39
42
|
return uniq_arcs
|
40
43
|
end
|
41
44
|
|
42
|
-
def
|
45
|
+
def sort!(args)
|
46
|
+
@arcs = @arcs.sort do |x,y|
|
47
|
+
xscore = 0
|
48
|
+
yitems = y.leaf_items(args[:period])
|
49
|
+
x.leaf_items(args[:period]).each do |xnode|
|
50
|
+
yitems.each do |ynode|
|
51
|
+
xscore = (xnode <=> ynode) # NOTE: Assumes caller has defined <=> for all leaf nodes
|
52
|
+
end
|
53
|
+
end
|
54
|
+
puts "\"#{x.pretty_name}\" #{xscore <=> 0} \"#{y.pretty_name}\""
|
55
|
+
xscore <=> 0
|
56
|
+
end
|
57
|
+
@arcs.each{ |arc| arc.sort!(args) }
|
58
|
+
end
|
59
|
+
|
60
|
+
def sprint_tree(indent_count=0, simplified=false)
|
43
61
|
indent = " " * indent_count
|
44
|
-
|
62
|
+
output = indent + "Calc: #{@title} (#{@role})" + "\n"
|
45
63
|
|
46
|
-
|
64
|
+
#@arcs.each { |arc| output += arc.sprint_tree(indent_count+1, simplified) }
|
65
|
+
top_level_arcs.each { |arc| output += arc.sprint_tree(indent_count+1, simplified) }
|
47
66
|
|
48
|
-
|
67
|
+
output += indent + "\n\n"
|
68
|
+
output
|
69
|
+
end
|
70
|
+
|
71
|
+
def print_tree(indent_count=0, simplified=false)
|
72
|
+
puts sprint_tree(indent_count, simplified)
|
49
73
|
end
|
50
74
|
|
51
75
|
def leaf_items(period)
|
@@ -83,6 +107,23 @@ module Xbrlware
|
|
83
107
|
end
|
84
108
|
end
|
85
109
|
|
110
|
+
def sort!(args)
|
111
|
+
if @children
|
112
|
+
@children = @children.sort do |x,y|
|
113
|
+
xscore = 0
|
114
|
+
yitems = y.leaf_items(args[:period])
|
115
|
+
x.leaf_items(args[:period]).each do |xnode|
|
116
|
+
yitems.each do |ynode|
|
117
|
+
xscore = (xnode <=> ynode) # NOTE: Assumes caller has defined <=> for all leaf nodes
|
118
|
+
end
|
119
|
+
end
|
120
|
+
puts "\"#{x.label}\" #{xscore <=> 0} \"#{y.label}\""
|
121
|
+
xscore <=> 0
|
122
|
+
end
|
123
|
+
end
|
124
|
+
(@children || []).each{ |child| child.sort!(args) }
|
125
|
+
end
|
126
|
+
|
86
127
|
def contains_arc?(arc)
|
87
128
|
return false if @children.empty?
|
88
129
|
|
@@ -94,19 +135,47 @@ module Xbrlware
|
|
94
135
|
return false
|
95
136
|
end
|
96
137
|
|
97
|
-
def
|
138
|
+
def sprint_tree(indent_count=0, simplified=false)
|
98
139
|
indent = " " * indent_count
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
140
|
+
str = "#{indent} CA:#{@label}"
|
141
|
+
|
142
|
+
if simplified
|
143
|
+
(@items.last(1) || []).each do |item|
|
144
|
+
str += " I:{#{item.pretty_name}} "
|
145
|
+
# FIXME: First off, sub-leaf is terrible, non-standard, confusing terminology. Call it something else.
|
146
|
+
# FIXME: Second, why aren't we calling Item::print_tree()?
|
147
|
+
if item.is_sub_leaf?
|
148
|
+
str += " [sub-leaf]"
|
149
|
+
else
|
150
|
+
str += " [non-sub-leaf]"
|
151
|
+
end
|
152
|
+
period = item.context.period
|
153
|
+
period_str = period.is_duration? ? "#{period.value["start_date"]} to #{period.value["end_date"]}" : "#{period.value}"
|
154
|
+
str += " [#{item.def["xbrli:balance"]}]" if item.def && item.def["xbrli:balance"]
|
155
|
+
str += " (#{period_str}) = #{item.value}" if item.value
|
156
|
+
end
|
157
|
+
else
|
158
|
+
(@items || []).each do |item|
|
159
|
+
str += " I:{#{item.pretty_name}} "
|
160
|
+
if item.is_sub_leaf?
|
161
|
+
str += " [sub-leaf]"
|
162
|
+
else
|
163
|
+
str += " [non-sub-leaf]"
|
164
|
+
end
|
165
|
+
period = item.context.period
|
166
|
+
period_str = period.is_duration? ? "#{period.value["start_date"]} to #{period.value["end_date"]}" : "#{period.value}"
|
167
|
+
str += " [#{item.def["xbrli:balance"]}]" if item.def && item.def["xbrli:balance"]
|
168
|
+
str += " (#{period_str}) = #{item.value}" if item.value
|
169
|
+
end
|
106
170
|
end
|
107
|
-
|
171
|
+
output = indent + str + "\n"
|
172
|
+
|
173
|
+
(@children || []).each { |child| output += child.sprint_tree(indent_count+1, simplified) }
|
174
|
+
output
|
175
|
+
end
|
108
176
|
|
109
|
-
|
177
|
+
def print_tree(indent_count=0, simplified=false)
|
178
|
+
puts sprint_tree(indent_count, simplified)
|
110
179
|
end
|
111
180
|
|
112
181
|
def leaf_items(period)
|
@@ -126,29 +195,39 @@ module Xbrlware
|
|
126
195
|
|
127
196
|
class PresentationLinkbase
|
128
197
|
class Presentation
|
129
|
-
def
|
198
|
+
def sprint_tree(indent_count=0, simplified=false)
|
130
199
|
indent = " " * indent_count
|
131
|
-
|
200
|
+
output = indent + "Pres: #{@title} (#{@role})" + "\n"
|
132
201
|
|
133
|
-
@arcs.each { |arc| arc.
|
202
|
+
@arcs.each { |arc| output += arc.sprint_tree(indent_count+1, simplified) }
|
134
203
|
|
135
|
-
|
204
|
+
output += indent + "\n\n"
|
205
|
+
output
|
206
|
+
end
|
207
|
+
|
208
|
+
def print_tree(indent_count=0, simplified=false)
|
209
|
+
puts sprint_tree(indent_count, simplified)
|
136
210
|
end
|
137
211
|
|
138
212
|
class PresentationArc
|
139
|
-
def
|
213
|
+
def sprint_tree(indent_count=0, simplified=false)
|
140
214
|
indent = " " * indent_count
|
141
|
-
|
215
|
+
str = "#{indent} #{@label}"
|
142
216
|
|
143
217
|
@items.each do |item|
|
144
218
|
period=item.context.period
|
145
219
|
period_str = period.is_duration? ? "#{period.value["start_date"]} to #{period.value["end_date"]}" : "#{period.value}"
|
146
|
-
|
147
|
-
|
220
|
+
str += " [#{item.def["xbrli:balance"]}]" unless item.def.nil?
|
221
|
+
str += " (#{period_str}) = #{item.value}" unless item.nil?
|
148
222
|
end
|
149
|
-
|
223
|
+
output = indent + str + "\n"
|
224
|
+
|
225
|
+
@children.each { |child| output += child.sprint_tree(indent_count+1, simplified) }
|
226
|
+
output
|
227
|
+
end
|
150
228
|
|
151
|
-
|
229
|
+
def print_tree(indent_count=0, simplified=false)
|
230
|
+
puts sprint_tree(indent_count, simplified)
|
152
231
|
end
|
153
232
|
end
|
154
233
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xbrlware-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.2.19.
|
4
|
+
version: 1.1.2.19.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,23 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: xbrlware-ruby19
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
|
-
- - =
|
19
|
+
- - '='
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: 1.1.2.19.2
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.2.19.2
|
26
30
|
- !ruby/object:Gem::Dependency
|
27
31
|
name: rspec
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
@@ -33,7 +37,12 @@ dependencies:
|
|
33
37
|
version: 2.0.1
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.0.1
|
37
46
|
description: A set of extentions that make it easier to build on top of xbrlware
|
38
47
|
email:
|
39
48
|
- jim.lindstrom@gmail.com
|
@@ -56,7 +65,6 @@ files:
|
|
56
65
|
- spec/spec_helper.rb
|
57
66
|
- spec/xbrlware_helpers_spec.rb
|
58
67
|
- xbrlware-extras.gemspec
|
59
|
-
has_rdoc: true
|
60
68
|
homepage: ''
|
61
69
|
licenses: []
|
62
70
|
post_install_message:
|
@@ -77,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
85
|
version: '0'
|
78
86
|
requirements: []
|
79
87
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.8.24
|
81
89
|
signing_key:
|
82
90
|
specification_version: 3
|
83
91
|
summary: A set of extentions that make it easier to build on top of xbrlware
|