Sha256: 6ca6e2386c429dc76848036e493d142f025955ca51db335f98ae16de3716bdc7

Contents?: true

Size: 498 Bytes

Versions: 6

Compression:

Stored size: 498 Bytes

Contents

module Hanami
  class View
    module ContextHelpers
      module ContentHelpers
        def initialize(content: {}, **options)
          super
        end

        def content_for(key, value = nil, &block)
          content = _options[:content]
          output = nil

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

          output
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hanami-view-2.0.0.alpha8 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.0.0.alpha7 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.0.0.alpha6 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.0.0.alpha5 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.0.0.alpha3 lib/hanami/view/context_helpers/content_helpers.rb
hanami-view-2.0.0.alpha2 lib/hanami/view/context_helpers/content_helpers.rb