class Gretel::Renderer::Base

Attributes

context[R]
options[R]

Public Class Methods

new(context, options) click to toggle source
# File lib/gretel/renderer.rb, line 229
def initialize(context, options)
  @context = context
  @options = options
end

Public Instance Methods

render_container(html) click to toggle source
# File lib/gretel/renderer.rb, line 247
def render_container(html)
end
render_current_fragment(link, position) click to toggle source
# File lib/gretel/renderer.rb, line 238
def render_current_fragment(link, position)
  url = options[:link_current] ? link.url : nil
  opts = fragment_options.merge(class: options[:current_class], current_link: link.url, aria_current: options[:aria_current])
  render_fragment_tag(fragment_tag, link.text, url, position, **opts)
end
render_fragment(link, position) click to toggle source
# File lib/gretel/renderer.rb, line 234
def render_fragment(link, position)
  render_fragment_tag(fragment_tag, link.text, link.url, position, **fragment_options)
end
render_fragment_tag(fragment_tag, text, url, position, options = {}) click to toggle source
# File lib/gretel/renderer.rb, line 244
def render_fragment_tag(fragment_tag, text, url, position, options = {})
end
render_posttext() click to toggle source
# File lib/gretel/renderer.rb, line 256
def render_posttext
  if options[:posttext].present?
    content_tag(:span, options[:posttext], class: options[:posttext_class])
  end
end
render_pretext() click to toggle source
# File lib/gretel/renderer.rb, line 250
def render_pretext
  if options[:pretext].present?
    content_tag(:span, options[:pretext], class: options[:pretext_class])
  end
end

Private Instance Methods

fragment_options() click to toggle source
# File lib/gretel/renderer.rb, line 268
def fragment_options
  options.slice(:fragment_class, :link_class, :link_data)
end
fragment_tag() click to toggle source
# File lib/gretel/renderer.rb, line 264
def fragment_tag
  options[:fragment_tag]
end
join_classes(*classes) click to toggle source
# File lib/gretel/renderer.rb, line 272
def join_classes(*classes)
  clazz = classes.join(' ').strip
  clazz.blank? ? nil : clazz
end
method_missing(method, *args, &block) click to toggle source

Proxy to view context.

# File lib/gretel/renderer.rb, line 283
def method_missing(method, *args, &block)
  context.send(method, *args, &block)
end