Class: Spix::FeedDiscovery::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/spix_parser/tools/feed_discovery/base.rb

Constant Summary collapse

USER_AGENT =

HTTP “User-Agent” header to send to servers when downloading feeds.

"SpixParser"

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Base

Returns a new instance of Base.



7
8
9
10
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 7

def initialize uri
  self.uri = uri 
  self.document = FeedDiscovery::Document.new uri
end

Instance Method Details

#include_it_self(&block) ⇒ Object



43
44
45
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 43

def include_it_self &block
  items << Feed.new(uri.to_s, document.favicon)
end

#itemsObject



52
53
54
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 52

def items
  @items ||= [] 
end

#list(&block) ⇒ Object



30
31
32
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 30

def list &block
  @document.feeds &block
end

#list_uris(&block) ⇒ Object



34
35
36
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 34

def list_uris &block
  @document.feed_uris &block
end

#uriObject



16
17
18
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 16

def uri
  @uri
end

#uri=(value) ⇒ Object



12
13
14
# File 'lib/spix_parser/tools/feed_discovery/base.rb', line 12

def uri= value
  @uri = URI.parse value
end