Class: Array
Instance Method Summary collapse
Instance Method Details
#first_or_self ⇒ Object
2 3 4 |
# File 'lib/microformat/array.rb', line 2 def first_or_self size > 1 ? self : first end |
#to_atom(options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mofo/hentry.rb', line 53 def to_atom( = {}) 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"> #{first.atom_id} <link type="text/html" href="#{first.base_url}" rel="alternate"/> <title>#{[:title]}</title> <updated>#{(first.updated || first.published).try(:xmlschema)}</updated> #{entries} </feed> end_atom end |