Class: Entry

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEntry

Returns a new instance of Entry.



34
35
36
# File 'lib/feed_ninja/atomish.rb', line 34

def initialize
  @summary = []
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/feed_ninja/atomish.rb', line 32

def id
  @id
end

#imagesObject

Returns the value of attribute images.



32
33
34
# File 'lib/feed_ninja/atomish.rb', line 32

def images
  @images
end

Returns the value of attribute link.



32
33
34
# File 'lib/feed_ninja/atomish.rb', line 32

def link
  @link
end

#summaryObject

Returns the value of attribute summary.



32
33
34
# File 'lib/feed_ninja/atomish.rb', line 32

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



32
33
34
# File 'lib/feed_ninja/atomish.rb', line 32

def title
  @title
end

#updatedObject

Returns the value of attribute updated.



32
33
34
# File 'lib/feed_ninja/atomish.rb', line 32

def updated
  @updated
end

Instance Method Details

#contentObject



49
50
51
52
53
54
55
56
57
# File 'lib/feed_ninja/atomish.rb', line 49

def content
  Array(@images).inject("") do |memo, src|
    memo += %{
    <a href="#{src}">
      <img src="#{src}"/>
    </a>
    }
  end + @summary.join("\n")
end

#to_sObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/feed_ninja/atomish.rb', line 38

def to_s
  %{  <entry>
  <title>#{@title}</title>
  <link rel="alternate" type="text/html" href="#{@link}" />
  <id>#{@id}</id>
  <updated>#{@updated}</updated>
  <content type="html">#{self.content.encode(:xml => :text)}</content>
</entry>
}
end