Sha256: ecbf1e8495408f2c308156595cf64d5a761724073c43faf6ce4649c80c4526f7

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

Contents

require 'lotus/views/default_template_finder'

module Lotus
  module Views
    # The default view that is rendered for non successful responses (200 and 201)
    #
    # @since 0.1.0
    # @api private
    class Default
      include Lotus::View

      configuration.reset!

      layout nil
      root Pathname.new(File.dirname(__FILE__)).join('../templates').realpath
      template 'default'

      def title
        response[2].first
      end

      def self.render(root, template_name, context)
        format   = context[:format]
        template = DefaultTemplateFinder.new(self, root, template_name, format).find

        if template
          new(template, context).render
        else
          super(context)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lotusrb-0.6.1 lib/lotus/views/default.rb
lotusrb-0.6.0 lib/lotus/views/default.rb