Class: Array

Inherits:
Object show all
Defined in:
lib/mofo/hentry.rb,
lib/microformat/array.rb

Instance Method Summary collapse

Instance Method Details

#first_or_selfObject



2
3
4
# File 'lib/microformat/array.rb', line 2

def first_or_self
  size > 1 ? self : first
end

#to_atom(options = {}) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/mofo/hentry.rb', line 79

def to_atom(options = {})
  entries = map { |entry| entry.try(:to_atom) }.compact.join("\n")
  <<-end_atom
<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
<id>#{first.base_url}</id>
<link type="text/html" href="#{first.base_url}" rel="alternate"/>
<title>#{options[:title]}</title>
<updated>#{(first.updated || first.published).try(:xmlschema)}</updated>
#{entries}
</feed>
  end_atom
end