Sha256: 5c909d100ac4121a3b0df9a6e729c7f9f0320f3d1bb9718119fd22c316cdb6b1

Contents?: true

Size: 1.41 KB

Versions: 22

Compression:

Stored size: 1.41 KB

Contents

require 'hanami/view/rendering/templates_finder'

module Hanami
  module View
    module Rendering
      # Find a template for the current view context.
      # It's used when a template wants to render another template.
      #
      # @see Hanami::View::Rendering::Template
      # @see Hanami::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 [Hanami::View::Template] the requested template
        #
        # @api private
        # @since 0.1.0
        #
        # @see Hanami::View::Rendering::TemplatesFinder#find
        # @see Hanami::View::Rendering::Template#render
        def find
          super.first
        end

        protected
        # @api private
        def template_name
          @options[:template]
        end

        # @api private
        def format
          @options[:format]
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hanami-view-1.3.3 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.3.2 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.3.1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.3.0 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.2.1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.3.0.beta1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.2.0 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.2 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.2.0.rc2 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.2.0.rc1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.2.0.beta2 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.2.0.beta1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.0 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.0.rc1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.0.beta3 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.0.beta2 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.1.0.beta1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.0.1 lib/hanami/view/rendering/template_finder.rb
hanami-view-1.0.0 lib/hanami/view/rendering/template_finder.rb