Class | RSS::XMLStyleSheet |
In: |
rss/xml-stylesheet.rb
|
Parent: | Object |
ATTRIBUTES | = | %w(href type title media charset alternate) |
GUESS_TABLE | = | { "xsl" => "text/xsl", "css" => "text/css", } |
do_validate | [RW] |
# File rss/xml-stylesheet.rb, line 37 def initialize(*attrs) @do_validate = true ATTRIBUTES.each do |attr| self.send("#{attr}=", nil) end vars = ATTRIBUTES.dup vars.unshift(:do_validate) attrs.each do |name, value| if vars.include?(name.to_s) self.send("#{name}=", value) end end end
# File rss/xml-stylesheet.rb, line 75 def alternate=(value) if value.nil? or /\A(?:yes|no)\z/ =~ value @alternate = value else if @do_validate args = ["?xml-stylesheet?", %Q[alternate="#{value}"]] raise NotAvailableValueError.new(*args) end end @alternate end
# File rss/xml-stylesheet.rb, line 66 def href=(value) @href = value if @href and @type.nil? @type = guess_type(@href) end @href end