Class: Sheety::Feed
Direct Known Subclasses
Constant Summary collapse
- LINK_SELF =
'self'
- LINK_EDIT =
'edit'
- LINK_ALT =
'alternate'
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Instance Method Summary collapse
- #as_xml ⇒ Object
-
#initialize(parent, entry = nil) ⇒ Feed
constructor
A new instance of Feed.
- #link(key) ⇒ Object
- #parse(entry) ⇒ Object
Methods included from Children
#_get_i_val, #_passes_constraint, included
Constructor Details
#initialize(parent, entry = nil) ⇒ Feed
Returns a new instance of Feed.
14 15 16 17 18 19 20 |
# File 'lib/sheety/feed.rb', line 14 def initialize(parent, entry=nil) @parent = parent @links = {} unless entry.nil? parse(entry) end end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
10 11 12 |
# File 'lib/sheety/feed.rb', line 10 def content @content end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/sheety/feed.rb', line 10 def id @id end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
10 11 12 |
# File 'lib/sheety/feed.rb', line 10 def parent @parent end |
#title ⇒ Object
Returns the value of attribute title.
12 13 14 |
# File 'lib/sheety/feed.rb', line 12 def title @title end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
10 11 12 |
# File 'lib/sheety/feed.rb', line 10 def updated @updated end |
Instance Method Details
#as_xml ⇒ Object
36 37 38 |
# File 'lib/sheety/feed.rb', line 36 def as_xml return "<entry></entry>" end |
#link(key) ⇒ Object
32 33 34 |
# File 'lib/sheety/feed.rb', line 32 def link(key) @links[key] end |
#parse(entry) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/sheety/feed.rb', line 22 def parse(entry) return if entry.blank? || entry.length == 0 @title = Sheety::Feed.deref(entry, 'title', 0, 'content') @id = Sheety::Feed.deref(entry, 'id', 0) @content = Sheety::Feed.deref(entry, 'content', 'content') @updated = Sheety::Feed.deref(entry, 'updated', 0) @updated = DateTime.iso8601(@updated) if !@updated.blank? add_links(Sheety::Feed.deref(entry ,'link')) end |