Sha256: 4bca6fb27fcd13daef9b43cc1fa69c55ec60736b541849cce9dbe3d4f70d89f5
Contents?: true
Size: 963 Bytes
Versions: 3
Compression:
Stored size: 963 Bytes
Contents
# frozen_string_literal: true module Hanami class View # Provides a baseline environment across all the templates, parts and scopes # in a given rendering. # # @abstract Subclass this and add your own methods (along with a custom # `#initialize` if you wish to inject dependencies) # # @api public class Context include DecoratedAttributes # @api private attr_reader :_rendering # @api private def self.new(rendering: RenderingMissing.new, **args) allocate.tap do |obj| obj.instance_variable_set(:@_rendering, rendering) obj.send(:initialize, **args) end end # Returns a new instance of Context # # @api public def initialize(**) end # @api private def dup_for_rendering(rendering) dup.tap do |obj| obj.instance_variable_set(:@_rendering, rendering) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-view-2.1.0.rc1 | lib/hanami/view/context.rb |
hanami-view-2.1.0.beta2 | lib/hanami/view/context.rb |
hanami-view-2.1.0.beta1 | lib/hanami/view/context.rb |