Class: Hanami::View::Rendering Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/view/rendering.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, format:, context:) ⇒ Rendering

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Rendering.

Since:

  • 2.1.0



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hanami/view/rendering.rb', line 22

def initialize(config:, format:, context:)
  @config = config
  @format = format

  @inflector = config.inflector
  @part_builder = config.part_builder
  @scope_builder = config.scope_builder

  @context = context.dup_for_rendering(self)
  @renderer = Renderer.new(config)
end

Instance Attribute Details

#configObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



10
11
12
# File 'lib/hanami/view/rendering.rb', line 10

def config
  @config
end

#contextObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



18
19
20
# File 'lib/hanami/view/rendering.rb', line 18

def context
  @context
end

#formatObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



10
11
12
# File 'lib/hanami/view/rendering.rb', line 10

def format
  @format
end

#inflectorObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



14
15
16
# File 'lib/hanami/view/rendering.rb', line 14

def inflector
  @inflector
end

#part_builderObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



14
15
16
# File 'lib/hanami/view/rendering.rb', line 14

def part_builder
  @part_builder
end

#rendererObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



18
19
20
# File 'lib/hanami/view/rendering.rb', line 18

def renderer
  @renderer
end

#scope_builderObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



14
15
16
# File 'lib/hanami/view/rendering.rb', line 14

def scope_builder
  @scope_builder
end

Instance Method Details

#part(name, value, as: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



48
49
50
# File 'lib/hanami/view/rendering.rb', line 48

def part(name, value, as: nil)
  part_builder.(name, value, as: as, rendering: self)
end

#partial(name, scope, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



42
43
44
# File 'lib/hanami/view/rendering.rb', line 42

def partial(name, scope, &block)
  renderer.partial(name, format, scope, &block)
end

#scope(name = nil, locals) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



54
55
56
# File 'lib/hanami/view/rendering.rb', line 54

def scope(name = nil, locals) # rubocop:disable Style/OptionalArguments
  scope_builder.(name, locals: locals, rendering: self)
end

#template(name, scope, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.1.0



36
37
38
# File 'lib/hanami/view/rendering.rb', line 36

def template(name, scope, &block)
  renderer.template(name, format, scope, &block)
end