Sha256: cabbdd4b0acb3733bedf3a167e655f5a863946b7bfa34f49dc72cab33f5eab25

Contents?: true

Size: 482 Bytes

Versions: 4

Compression:

Stored size: 482 Bytes

Contents

module Hanami
  class View
    module ContextHelpers
      module ContentHelpers
        def initialize(**)
          @content_for = {}
          super
        end

        def content_for(key, value = nil, &block)
          output = nil

          if block
            @content_for[key] = yield
          elsif value
            @content_for[key] = value
          else
            output = @content_for[key]
          end

          output
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hanami-view-2.1.0.rc2 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.1.0.rc1 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.1.0.beta2 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.1.0.beta1 lib/hanami/view/context_helpers/content_helpers.rb