class Tourguide::Renderers::Link
Attributes
label[R]
options[R]
type[R]
Public Class Methods
new(context, label, type, options={})
click to toggle source
# File lib/tourguide/renderers/link.rb, line 7 def initialize(context, label, type, options={}) @context = context @label = label @type = type @options = options.reverse_merge default_options end
Public Instance Methods
render()
click to toggle source
# File lib/tourguide/renderers/link.rb, line 14 def render @context.link_to label.html_safe, options[:href], html_options end
Private Instance Methods
css_class()
click to toggle source
# File lib/tourguide/renderers/link.rb, line 31 def css_class out = [options[:class]] out << 'tour-link' out << "tourbus-#{type}" out.compact.join(' ') end
default_options()
click to toggle source
# File lib/tourguide/renderers/link.rb, line 20 def default_options { href: 'javascript:void(0);', class: nil } end
html_options()
click to toggle source
# File lib/tourguide/renderers/link.rb, line 27 def html_options options.except(:label, :href).merge({class: css_class}) end