Sha256: 05aebf3851ddde26ca49f0f0f3c1260bff45929f3adff6e68c546590f68c693d

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

require 'lotus/view/rendering/templates_finder'

module Lotus
  module View
    module Rendering
      # Find a template for the current view context.
      # It's used when a template wants to render another template.
      #
      # @see Lotus::View::Rendering::Template
      # @see Lotus::View::Rendering::TemplatesFinder
      #
      # @api private
      # @since 0.1.0
      class TemplateFinder < TemplatesFinder
        # Initialize a finder
        #
        # @param view [Class] a view
        # @param options [Hash] the informations about the context
        # @option options [String] :template the template file name
        # @option options [Symbol] :format the requested format
        #
        # @api private
        # @since 0.1.0
        def initialize(view, options)
          super(view)
          @options = options
        end

        # Find a template for the current view context
        #
        # @return [Lotus::View::Template] the requested template
        #
        # @api private
        # @since 0.1.0
        #
        # @see Lotus::View::Rendering::TemplatesFinder#find
        # @see Lotus::View::Rendering::Template#render
        def find
          super.first
        end

        protected
        def template_name
          @options[:template]
        end

        def format
          @options[:format]
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lotus-view-0.5.0 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.4.4 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.4.3 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.4.2 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.4.1 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.4.0 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.3.0 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.2.0 lib/lotus/view/rendering/template_finder.rb
lotus-view-0.1.0 lib/lotus/view/rendering/template_finder.rb