class Inkcite::Renderer::Topic

Public Instance Methods

render(tag, opt, ctx) click to toggle source
# File lib/inkcite/renderer/topic.rb, line 20
def render tag, opt, ctx

  name = opt[:name]

  if name.blank?
    ctx.error 'Every topic must have a name'

  else

    # Initialize the array of topic instances that live in the
    # View's arbitrary data holder.
    ctx.data[:topics] ||= []

    # Push a topic instance onto the list
    ctx.data[:topics] << Instance.new(name, opt[:priority].to_i)

  end

  nil
end