class Tourguide::Renderers::Group

Attributes

options[R]
stops[R]

Public Class Methods

new(context, options={}) click to toggle source
# File lib/tourguide/renderers/group.rb, line 7
def initialize(context, options={})
  @context = context
  @options = options.reverse_merge default_options
  @stops   = []
end

Public Instance Methods

render() click to toggle source
# File lib/tourguide/renderers/group.rb, line 13
def render
  stops.each_with_index.map do |renderer, i|
    renderer.count = i
    renderer.total = total_stops
    renderer.render
  end.join("\n")
end
stop(options={}) { |renderer| ... } click to toggle source
# File lib/tourguide/renderers/group.rb, line 21
 def stop(options={}, &block)
  renderer = Tourguide::Renderers::Stop.new(@context, options)
  yield(renderer) if block_given?
  stops << renderer
end
total_stops() click to toggle source
# File lib/tourguide/renderers/group.rb, line 27
def total_stops
  @stops.count
end

Private Instance Methods

default_options() click to toggle source
# File lib/tourguide/renderers/group.rb, line 33
def default_options
  {}
end