Class: AtomIshWriter
- Inherits:
-
Object
- Object
- AtomIshWriter
- Defined in:
- lib/feed_ninja/atomish.rb
Instance Attribute Summary collapse
-
#link ⇒ Object
Returns the value of attribute link.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated ⇒ Object
Returns the value of attribute updated.
Instance Method Summary collapse
-
#initialize ⇒ AtomIshWriter
constructor
A new instance of AtomIshWriter.
- #new_entry(index) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ AtomIshWriter
Returns a new instance of AtomIshWriter.
3 4 5 |
# File 'lib/feed_ninja/atomish.rb', line 3 def initialize @entries = [] end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
2 3 4 |
# File 'lib/feed_ninja/atomish.rb', line 2 def link @link end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/feed_ninja/atomish.rb', line 2 def title @title end |
#updated ⇒ Object
Returns the value of attribute updated.
2 3 4 |
# File 'lib/feed_ninja/atomish.rb', line 2 def updated @updated end |
Instance Method Details
#new_entry(index) ⇒ Object
7 8 9 10 11 |
# File 'lib/feed_ninja/atomish.rb', line 7 def new_entry(index) item = Entry.new item = yield item @entries[index] = item end |
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/feed_ninja/atomish.rb', line 13 def to_s %{<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>#{@title}</title> <id>#{@link}</id> <link href="#{@link}"/> <updated>#{@updated}</updated> <author> <name>FeedNinja</name> <uri>http://github.com/Tourniquet/feedninja</uri> <email>[email protected]</email> </author> #{@entries.inject { |memo, entry| memo.to_s + entry.to_s }.to_s}</feed>} end |