class RSS::Maker::RSS10::Channel
Public Instance Methods
to_feed(rss)
click to toggle source
# File rss/maker/1.0.rb, line 31 def to_feed(rss) set_default_values do _not_set_required_variables = not_set_required_variables if _not_set_required_variables.empty? channel = RDF::Channel.new(@about) setup_values(channel) channel.dc_dates.clear rss.channel = channel set_parent(channel, rss) setup_items(rss) setup_image(rss) setup_textinput(rss) setup_other_elements(rss, channel) else raise NotSetError.new("maker.channel", _not_set_required_variables) end end end
Private Instance Methods
not_set_required_variables()
click to toggle source
Calls superclass method
# File rss/maker/1.0.rb, line 86 def not_set_required_variables vars = super vars << "description" unless description {|d| d.have_required_values?} vars << "title" unless title {|t| t.have_required_values?} vars end
required_variable_names()
click to toggle source
# File rss/maker/1.0.rb, line 82 def required_variable_names %w(about link) end
setup_image(rss)
click to toggle source
# File rss/maker/1.0.rb, line 66 def setup_image(rss) if @maker.image.have_required_values? image = RDF::Channel::Image.new(@maker.image.url) rss.channel.image = image set_parent(image, rss.channel) end end
setup_items(rss)
click to toggle source
# File rss/maker/1.0.rb, line 51 def setup_items(rss) items = RDF::Channel::Items.new seq = items.Seq set_parent(items, seq) target_items = @maker.items.normalize raise NotSetError.new("maker", ["items"]) if target_items.empty? target_items.each do |item| li = RDF::Channel::Items::Seq::Li.new(item.link) seq.lis << li set_parent(li, seq) end rss.channel.items = items set_parent(rss.channel, items) end
setup_textinput(rss)
click to toggle source
# File rss/maker/1.0.rb, line 74 def setup_textinput(rss) if @maker.textinput.have_required_values? textinput = RDF::Channel::Textinput.new(@maker.textinput.link) rss.channel.textinput = textinput set_parent(textinput, rss.channel) end end