Class: SimpleRSS

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

Constant Summary collapse

VERSION =
"1.3.1"
@@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',
	:'media:content#url', :'media:content#type', :'media:content#height', :'media:content#width',
	:'media:title', :'media:thumbnail#url', :'media:thumbnail#height', :'media:thumbnail#width',
	:'media:credit', :'media:credit#role',
	:'media:category', :'media:category#scheme'
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SimpleRSS


40
41
42
43
44
45
46
# File 'lib/simple-rss.rb', line 40

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


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

def feed_tags
	@@feed_tags
end

.feed_tags=(ft) ⇒ Object


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

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

.item_tagsObject


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

def item_tags
	@@item_tags
end

.item_tags=(it) ⇒ Object


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

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

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

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


67
68
69
# File 'lib/simple-rss.rb', line 67

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

Instance Method Details

#channelObject Also known as: feed


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

def channel() self end