Class: VirtualFeed

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



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

def entries
  @entries
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#entry_countObject



27
28
29
# File 'lib/virtual_feed.rb', line 27

def entry_count
  Entry.count(finder_params)
end

#finder_paramsObject



15
16
17
18
# File 'lib/virtual_feed.rb', line 15

def finder_params
  # To prevent ActiveRecord from altering the hash when passed into #find
  @finder_params.clone
end

#finder_params=(hash) ⇒ Object



5
6
7
8
# File 'lib/virtual_feed.rb', line 5

def finder_params=(hash)
  LOGGER.debug("setting finder params to #{hash.inspect}")
  @finder_params = hash
end

#last_updatedObject



31
32
33
34
35
36
37
38
# File 'lib/virtual_feed.rb', line 31

def last_updated
  if entries.empty?
    nil
  else
    entry = Entry.find(:first, finder_params)
    entry.date_published || entry.updated_at
  end
end

#reloadObject

This is to make the Virtual Feed walk like a duck



11
12
13
# File 'lib/virtual_feed.rb', line 11

def reload
  self
end