Class: Vanilla::AtomFeed

Inherits:
Object
  • Object
show all
Defined in:
lib/vanilla/atom_feed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#appObject (readonly)

Returns the value of attribute app.



5
6
7
# File 'lib/vanilla/atom_feed.rb', line 5

def app
  @app
end

#domainObject (readonly)

Returns the value of attribute domain.



5
6
7
# File 'lib/vanilla/atom_feed.rb', line 5

def domain
  @domain
end

#titleObject (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_sObject



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