Class: Vanilla::AtomFeed
- Inherits:
-
Object
- Object
- Vanilla::AtomFeed
- Defined in:
- lib/vanilla/atom_feed.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ AtomFeed
constructor
A new instance of AtomFeed.
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ AtomFeed
Returns a new instance of AtomFeed.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vanilla/atom_feed.rb', line 7 def initialize(params={}) @domain = params[:domain] || "yourdomain.example.com" @title = params[:title] || domain @app = params[:app] @criteria = params[:matching] @snips = params[:snips] if @snips.nil? if @criteria.nil? @snips = app.soup.all_snips else @snips = app.soup[@criteria] end end @count = params[:count] || @snips.length end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
5 6 7 |
# File 'lib/vanilla/atom_feed.rb', line 5 def app @app end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
5 6 7 |
# File 'lib/vanilla/atom_feed.rb', line 5 def domain @domain end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/vanilla/atom_feed.rb', line 5 def title @title end |
Instance Method Details
#to_s ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/vanilla/atom_feed.rb', line 23 def to_s Atom::Feed.new do |f| f.title = title f.updated = most_recent_updated_at f.id = "tag:x,2008-06-01:kind/x" f.entries = entries end.to_xml end |