Module: RSS::RootElementMixin
- Includes:
- XMLStyleSheetMixin
- Included in:
- Atom::Entry, Atom::Feed, RDF, Rss
- Defined in:
- lib/rss/rss.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#feed_subtype ⇒ Object
readonly
Returns the value of attribute feed_subtype.
-
#feed_type ⇒ Object
readonly
Returns the value of attribute feed_type.
-
#feed_version ⇒ Object
readonly
Returns the value of attribute feed_version.
-
#output_encoding ⇒ Object
Returns the value of attribute output_encoding.
-
#standalone ⇒ Object
Returns the value of attribute standalone.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes included from XMLStyleSheetMixin
Instance Method Summary collapse
- #feed_info ⇒ Object
- #initialize(feed_version, version = nil, encoding = nil, standalone = nil) ⇒ Object
- #setup_maker(maker) ⇒ Object
- #to_atom(type, &block) ⇒ Object
- #to_feed(type, &block) ⇒ Object
- #to_rss(type, &block) ⇒ Object
- #to_xml(type = nil, &block) ⇒ Object
Instance Attribute Details
#encoding ⇒ Object
Returns the value of attribute encoding.
1273 1274 1275 |
# File 'lib/rss/rss.rb', line 1273 def encoding @encoding end |
#feed_subtype ⇒ Object (readonly)
Returns the value of attribute feed_subtype.
1272 1273 1274 |
# File 'lib/rss/rss.rb', line 1272 def feed_subtype @feed_subtype end |
#feed_type ⇒ Object (readonly)
Returns the value of attribute feed_type.
1272 1273 1274 |
# File 'lib/rss/rss.rb', line 1272 def feed_type @feed_type end |
#feed_version ⇒ Object (readonly)
Returns the value of attribute feed_version.
1272 1273 1274 |
# File 'lib/rss/rss.rb', line 1272 def feed_version @feed_version end |
#output_encoding ⇒ Object
Returns the value of attribute output_encoding.
1271 1272 1273 |
# File 'lib/rss/rss.rb', line 1271 def output_encoding @output_encoding end |
#standalone ⇒ Object
Returns the value of attribute standalone.
1273 1274 1275 |
# File 'lib/rss/rss.rb', line 1273 def standalone @standalone end |
#version ⇒ Object
Returns the value of attribute version.
1273 1274 1275 |
# File 'lib/rss/rss.rb', line 1273 def version @version end |
Instance Method Details
#feed_info ⇒ Object
1285 1286 1287 |
# File 'lib/rss/rss.rb', line 1285 def feed_info [@feed_type, @feed_version, @feed_subtype] end |
#initialize(feed_version, version = nil, encoding = nil, standalone = nil) ⇒ Object
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 |
# File 'lib/rss/rss.rb', line 1274 def initialize(feed_version, version=nil, encoding=nil, standalone=nil) super() @feed_type = nil @feed_subtype = nil @feed_version = feed_version @version = version || '1.0' @encoding = encoding @standalone = standalone @output_encoding = nil end |
#setup_maker(maker) ⇒ Object
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 |
# File 'lib/rss/rss.rb', line 1294 def setup_maker(maker) maker.version = version maker.encoding = encoding maker.standalone = standalone xml_stylesheets.each do |xss| xss.setup_maker(maker) end super end |
#to_atom(type, &block) ⇒ Object
1317 1318 1319 |
# File 'lib/rss/rss.rb', line 1317 def to_atom(type, &block) to_feed("atom:#{type}", &block) end |
#to_feed(type, &block) ⇒ Object
1306 1307 1308 1309 1310 1311 |
# File 'lib/rss/rss.rb', line 1306 def to_feed(type, &block) Maker.make(type) do |maker| setup_maker(maker) block.call(maker) if block end end |
#to_rss(type, &block) ⇒ Object
1313 1314 1315 |
# File 'lib/rss/rss.rb', line 1313 def to_rss(type, &block) to_feed("rss#{type}", &block) end |
#to_xml(type = nil, &block) ⇒ Object
1321 1322 1323 1324 1325 1326 1327 |
# File 'lib/rss/rss.rb', line 1321 def to_xml(type=nil, &block) if type.nil? or same_feed_type?(type) to_s else to_feed(type, &block).to_s end end |