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