Sha256: 25e7fe6cdebcdb602297f946e7bdf37da9a7b6ed593cb524446cdc1bab6b4fc6

Contents?: true

Size: 574 Bytes

Versions: 6

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

module Hanami
  module View
    module Rendering
      # Rendering options
      #
      # @since 1.1.1
      # @api private
      class Options
        # @since 1.1.1
        # @api private
        def self.build(options, locals, format)
          options.dup.tap do |opts|
            opts[:format] ||= format
            opts[:locals] = locals
            opts[:locals].merge!(options.fetch(:locals) { ::Hash.new })
            opts[:locals].merge!(format: opts.fetch(:format, format))
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hanami-view-1.3.3 lib/hanami/view/rendering/options.rb
hanami-view-1.3.2 lib/hanami/view/rendering/options.rb
hanami-view-1.3.1 lib/hanami/view/rendering/options.rb
hanami-view-1.3.0 lib/hanami/view/rendering/options.rb
hanami-view-1.2.1 lib/hanami/view/rendering/options.rb
hanami-view-1.3.0.beta1 lib/hanami/view/rendering/options.rb