Class: Opml

Inherits:
Object
  • Object
show all
Defined in:
lib/opml.rb

Defined Under Namespace

Modules: VERSION Classes: Outline

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Opml

Returns a new instance of Opml.



50
51
52
53
54
55
56
57
# File 'lib/opml.rb', line 50

def initialize(xml)
  @doc = REXML::Document.new(xml)

  parse_head_elements :title, :owner_name, :owner_email
  parse_head_elements :date_created, :date_modified, :with => Proc.new { |e| Time.parse(e) }

  @outlines = document_body ? initialize_outlines_from_document_body : []
end

Instance Attribute Details

#outlinesObject (readonly)

Returns the value of attribute outlines.



48
49
50
# File 'lib/opml.rb', line 48

def outlines
  @outlines
end

Instance Method Details

#flattenObject



59
60
61
# File 'lib/opml.rb', line 59

def flatten
  @flatten ||= @outlines.map(&:flatten).flatten
end