Class: Dry::Types::Printer::Composition Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/types/printer/composition.rb

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.

Instance Method Summary collapse

Constructor Details

#initialize(printer, composition_class) ⇒ Composition

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 Composition.



9
10
11
12
13
# File 'lib/dry/types/printer/composition.rb', line 9

def initialize(printer, composition_class)
  @printer = printer
  @composition_class = composition_class
  freeze
end

Instance Method Details

#visit(composition) ⇒ 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.



15
16
17
18
19
20
21
# File 'lib/dry/types/printer/composition.rb', line 15

def visit(composition)
  visit_constructors(composition) do |constructors|
    @printer.visit_options(composition.options, composition.meta) do |opts|
      yield "#{@composition_class.composition_name}<#{constructors}#{opts}>"
    end
  end
end