Sha256: 669e404883cdf09f2403ad255e769f2e620d0b1b0421fca49f395f3e6a72f6b0
Contents?: true
Size: 921 Bytes
Versions: 13
Compression:
Stored size: 921 Bytes
Contents
module Navi module Renderers class Base attr_accessor :context, :controller, :template def initialize(context) @context = context @controller = controller_from @context @template = template_from @controller end def render(collection) raise NotImplementedError end private # Pretty much lifted from # https://github.com/andi/simple-navigation/blob/master/lib/simple_navigation/adapters/rails.rb def controller_from(context) context.respond_to?(:controller) ? context.controller : context end # Pretty much lifted from # https://github.com/andi/simple-navigation/blob/master/lib/simple_navigation/adapters/rails.rb def template_from(controller) controller.respond_to?(:view_context) ? controller.view_context : controller.instance_variable_get(:@template) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems