Sha256: 556ab565bce267837ee9946a2f7aee86181106962f5ebff88766f004ed51a9df

Contents?: true

Size: 1.22 KB

Versions: 27

Compression:

Stored size: 1.22 KB

Contents

module Hanami
  module View
    module Rendering
      # Null Object pattern for Layout.
      # It's used when a view doesn't require a layout.
      #
      # @api private
      # @since 0.1.0
      #
      # @example
      #   require 'hanami/view'
      #
      #   module Articles
      #     class Show
      #       include Hanami::View
      #       layout false
      #     end
      #   end
      #
      #   # In this scenario we will use a `NullLayout`.
      class NullLayout

        # Initialize a layout
        #
        # @param scope [Hanami::View::Rendering::Scope] view rendering scope
        # @param rendered [String] the output of the view rendering process
        #
        # @api private
        # @since 0.1.0
        #
        # @see Hanami::Layout#initialize
        # @see Hanami::View::Rendering#render
        def initialize(scope, rendered)
          @rendered = rendered
        end

        # Render the layout
        #
        # @return [String] the output of the rendering process
        #
        # @api private
        # @since 0.1.0
        #
        # @see Hanami::Layout#render
        # @see Hanami::View::Rendering#render
        def render
          @rendered
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

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