Class: Xbrlware::Linkbase::PresentationLinkbase::Presentation::PresentationArc

Inherits:
Object
  • Object
show all
Defined in:
lib/xbrlware-extras/linkbase.rb

Instance Method Summary collapse

Instance Method Details



229
230
231
# File 'lib/xbrlware-extras/linkbase.rb', line 229

def print_tree(indent_count=0, simplified=false)
  puts sprint_tree(indent_count, simplified)
end

#sprint_tree(indent_count = 0, simplified = false) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/xbrlware-extras/linkbase.rb', line 213

def sprint_tree(indent_count=0, simplified=false)
  indent = " " * indent_count
  str = "#{indent} #{@label}"

  @items.each do |item|
    period=item.context.period
    period_str = period.is_duration? ? "#{period.value["start_date"]} to #{period.value["end_date"]}" : "#{period.value}"
    str += " [#{item.def["xbrli:balance"]}]" unless item.def.nil?
    str += " (#{period_str}) = #{item.value}" unless item.nil?
  end
  output = indent + str + "\n"

  @children.each { |child| output += child.sprint_tree(indent_count+1, simplified) }
  output
end