Module: RSS::RootElementMixin

Includes:
XMLStyleSheetMixin
Included in:
RDF, Rss
Defined in:
lib/rss/rss.rb

Instance Attribute Summary collapse

Attributes included from XMLStyleSheetMixin

#xml_stylesheets

Instance Method Summary collapse

Instance Attribute Details

#output_encodingObject

Returns the value of attribute output_encoding.



942
943
944
# File 'lib/rss/rss.rb', line 942

def output_encoding
  @output_encoding
end

Instance Method Details

#initialize(rss_version, version = nil, encoding = nil, standalone = nil) ⇒ Object



944
945
946
947
948
949
950
951
# File 'lib/rss/rss.rb', line 944

def initialize(rss_version, version=nil, encoding=nil, standalone=nil)
  super()
  @rss_version = rss_version
  @version = version || '1.0'
  @encoding = encoding
  @standalone = standalone
  @output_encoding = nil
end

#setup_maker(maker) ⇒ Object



958
959
960
961
962
963
964
965
966
967
968
# File 'lib/rss/rss.rb', line 958

def setup_maker(maker)
  maker.version = version
  maker.encoding = encoding
  maker.standalone = standalone

  xml_stylesheets.each do |xss|
    xss.setup_maker(maker)
  end

  setup_maker_elements(maker)
end

#to_xml(version = nil, &block) ⇒ Object



970
971
972
973
974
975
976
977
978
979
# File 'lib/rss/rss.rb', line 970

def to_xml(version=nil, &block)
  if version.nil? or version == @rss_version
    to_s
  else
    RSS::Maker.make(version) do |maker|
      setup_maker(maker)
      block.call(maker) if block
    end.to_s
  end
end