Module
Attributes
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read
No documentation available
Read & Write
No documentation available
Read & Write
No documentation available
Read & Write
No documentation available
Class Methods
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1246
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
No documentation available
Instance Methods
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1257
def feed_info
[@feed_type, @feed_version, @feed_subtype]
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1338
def maker_target(target)
target
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1329
def ns_declarations
decls = {}
self.class::NSPOOL.collect do |prefix, uri|
prefix = ":#{prefix}" unless prefix.empty?
decls["xmlns#{prefix}"] = uri
end
decls
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1261
def output_encoding=(enc)
@output_encoding = enc
self.converter = Converter.new(@output_encoding, @encoding)
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1302
def same_feed_type?(type)
if /^(atom|rss)?(\d+\.\d+)?(?::(.+))?$/i =~ type
feed_type = ($1 || @feed_type).downcase
feed_version = $2 || @feed_version
feed_subtype = $3 || @feed_subtype
[feed_type, feed_version, feed_subtype] == feed_info
else
false
end
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1266
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
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1313
def tag(indent, attrs={}, &block)
rv = super(indent, ns_declarations.merge(attrs), &block)
return rv if rv.empty?
"#{xmldecl}#{xml_stylesheet_pi}#{rv}"
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1289
def to_atom(type, &block)
to_feed("atom:#{type}", &block)
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1278
def to_feed(type, &block)
Maker.make(type) do |maker|
setup_maker(maker)
block.call(maker) if block
end
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1285
def to_rss(type, &block)
to_feed("rss#{type}", &block)
end
No documentation available
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1293
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
No documentation available
#
lib/rss/rss.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/rss.rb, line 1319
def xmldecl
rv = %Q[<?xml version="#{@version}"]
if @output_encoding or @encoding
rv << %Q[ encoding="#{@output_encoding or @encoding}"]
end
rv << %Q[ standalone="yes"] if @standalone
rv << "?>\n"
rv
end
No documentation available