Class: ESS::Maker

Inherits:
Object
  • Object
show all
Defined in:
lib/ess/maker.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :version => "0.9",
  :lang => "en",
  :validate => true,
  :push => false
}

Class Method Summary collapse

Class Method Details

.make(options = {}, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ess/maker.rb', line 10

def self.make options={}, &block
  options = DEFAULT_OPTIONS.merge options
  ess = ESS.new
  ess.xmlns_attr "http://essfeed.org/history/#{options[:version]}"
  ess.version_attr options[:version]
  ess.lang_attr options[:lang]
  block.call(ess) if block
  ess.channel.generator.text!("ess:ruby:generator:version:#{options[:version]}") if ess.channel.generator.text! == ""
  ess.validate if options[:validate]
  ess.push_to_aggregators(options) if options[:push] || options[:aggregators]
  return ess
end