Class: AtomIshWriter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAtomIshWriter

Returns a new instance of AtomIshWriter.



3
4
5
# File 'lib/feed_ninja/atomish.rb', line 3

def initialize
  @entries = []
end

Instance Attribute Details

Returns the value of attribute link.



2
3
4
# File 'lib/feed_ninja/atomish.rb', line 2

def link
  @link
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/feed_ninja/atomish.rb', line 2

def title
  @title
end

#updatedObject

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_sObject



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