class Opml::Outline
Attributes
attributes[RW]
outlines[RW]
Public Class Methods
new(element)
click to toggle source
# File lib/opml.rb, line 18 def initialize(element) @attributes = map_attributes_to_hash(element.attributes) @outlines = element.elements.map { |element| Outline.new(element) } end
Public Instance Methods
flatten()
click to toggle source
# File lib/opml.rb, line 23 def flatten @flatten ||= @outlines.map(&:flatten).unshift(self) end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/opml.rb, line 36 def method_missing(method, *args, &block) attributes[method.to_s] || super end
respond_to?(method)
click to toggle source
Calls superclass method
# File lib/opml.rb, line 31 def respond_to?(method) return true if attributes[method.to_s] super end
to_s()
click to toggle source
Calls superclass method
# File lib/opml.rb, line 27 def to_s @to_s ||= attributes['text'] || super end
Private Instance Methods
map_attributes_to_hash(attributes)
click to toggle source
# File lib/opml.rb, line 41 def map_attributes_to_hash(attributes) hash = {} # returning({}) do |hash| # attributes.each { |key, value| hash[key.underscore] = value } # end attributes.each{ |key, value| hash[key] = value } return hash end