Class: SimpleRSS

Inherits:
Object
  • Object
show all
Defined in:
lib/simple-rss.rb

Constant Summary collapse

VERSION =
"1.2.2"
@@feed_tags =
[
	:id,
	:title, :subtitle, :link,
	:description, 
	:author, :webMaster, :managingEditor, :contributor,
	:pubDate, :lastBuildDate, :updated, :'dc:date',
	:generator, :language, :docs, :cloud,
	:ttl, :skipHours, :skipDays,
	:image, :logo, :icon, :rating,
	:rights, :copyright,
	:textInput, :'feedburner:browserFriendly',
	:'itunes:author', :'itunes:category'
]
@@item_tags =
[
	:id,
	:title, :link, :'link+alternate', :'link+self', :'link+edit', :'link+replies',
	:author, :contributor,
	:description, :summary, :content, :'content:encoded', :comments,
	:pubDate, :published, :updated, :expirationDate, :modified, :'dc:date',
	:category, :guid,
	:'trackback:ping', :'trackback:about',
	:'dc:creator', :'dc:title', :'dc:subject', :'dc:rights', :'dc:publisher',
	:'feedburner:origLink'
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, options = {}) ⇒ SimpleRSS

Returns a new instance of SimpleRSS.



36
37
38
39
40
41
42
# File 'lib/simple-rss.rb', line 36

def initialize(source, options={})
	@source = source.respond_to?(:read) ? source.read : source.to_s
	@items = Array.new
   @options = Hash.new.update(options)
   
	parse
end

Instance Attribute Details

#itemsObject (readonly) Also known as: entries

Returns the value of attribute items.



7
8
9
# File 'lib/simple-rss.rb', line 7

def items
  @items
end

#sourceObject (readonly)

Returns the value of attribute source.



7
8
9
# File 'lib/simple-rss.rb', line 7

def source
  @source
end

Class Method Details

.feed_tagsObject



48
49
50
# File 'lib/simple-rss.rb', line 48

def feed_tags
	@@feed_tags
end

.feed_tags=(ft) ⇒ Object



51
52
53
# File 'lib/simple-rss.rb', line 51

def feed_tags=(ft)
	@@feed_tags = ft
end

.item_tagsObject



55
56
57
# File 'lib/simple-rss.rb', line 55

def item_tags
	@@item_tags
end

.item_tags=(it) ⇒ Object



58
59
60
# File 'lib/simple-rss.rb', line 58

def item_tags=(it)
	@@item_tags = it
end

.parse(source, options = {}) ⇒ Object

The strict attribute is for compatibility with Ruby’s standard RSS parser



63
64
65
# File 'lib/simple-rss.rb', line 63

def parse(source, options={})
	new source, options
end

Instance Method Details

#channelObject Also known as: feed



44
# File 'lib/simple-rss.rb', line 44

def channel() self end