Class: Delicious

Inherits:
Object
  • Object
show all
Includes:
REXML
Defined in:
lib/shinmun/aggregations/delicious.rb

Defined Under Namespace

Classes: DeliciousItem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, refresh = true) ⇒ Delicious

Pass the url to the RSS feed you would like to keep tabs on by default this will request the rss from the server right away and fill the items array



18
19
20
21
22
23
# File 'lib/shinmun/aggregations/delicious.rb', line 18

def initialize(url, refresh = true)
  self.items  = []
  self.url    = url
  self.days   = {}
  self.refresh if refresh
end

Instance Attribute Details

#daysObject

Returns the value of attribute days.



8
9
10
# File 'lib/shinmun/aggregations/delicious.rb', line 8

def days
  @days
end

#itemsObject

Returns the value of attribute items.



8
9
10
# File 'lib/shinmun/aggregations/delicious.rb', line 8

def items
  @items
end

Returns the value of attribute link.



8
9
10
# File 'lib/shinmun/aggregations/delicious.rb', line 8

def link
  @link
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/shinmun/aggregations/delicious.rb', line 8

def title
  @title
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/shinmun/aggregations/delicious.rb', line 8

def url
  @url
end

Instance Method Details

#refreshObject

This method lets you refresh the items in the items array useful if you keep the object cached in memory and



27
28
29
30
31
# File 'lib/shinmun/aggregations/delicious.rb', line 27

def refresh
  open(@url) do |http|
    parse(http.read)
  end
end