class Tourguide::Renderers::Tourbus
Attributes
id[R]
options[R]
stops[R]
Public Class Methods
new(context, id, options={})
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 7 def initialize(context, id, options={}) @context = context @id = id @options = options.reverse_merge(default_options) @stops = [] end
Public Instance Methods
group(options={}) { |renderer| ... }
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 20 def group(options={}, &block) renderer = Tourguide::Renderers::Group.new(@context, options) yield(renderer) if block_given? stops << renderer end
render()
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 27 def render xhtml = Builder::XmlMarkup.new target: out=(''), indent: 2 xhtml.ul(ul_options) do |ul| ul << stops.map { |x| x.render }.join("\n") end xhtml.div class: 'tour-overlay' out.html_safe end
stop(options={}) { |renderer| ... }
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 14 def stop(options={}, &block) renderer = Tourguide::Renderers::Stop.new(@context, options) yield(renderer) if block_given? stops << renderer end
Private Instance Methods
css_classes()
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 45 def css_classes out = [] out << 'tourbus-legs' out << options[:class] out.compact.join(' ') end
default_options()
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 52 def default_options {} end
ul_options()
click to toggle source
# File lib/tourguide/renderers/tourbus.rb, line 38 def ul_options { id: id, class: css_classes }.merge(options.except(:class)) end