Class: Dry::Configurable::Compiler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/configurable/compiler.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.

Setting compiler used internally by the DSL

API:

  • private

Instance Method Summary collapse

Instance Method Details

#call(ast) ⇒ 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.

API:

  • private



9
10
11
12
13
14
15
# File 'lib/dry/configurable/compiler.rb', line 9

def call(ast)
  Settings.new.tap do |settings|
    ast.each do |node|
      settings << visit(node)
    end
  end
end

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

API:

  • private



18
19
20
21
# File 'lib/dry/configurable/compiler.rb', line 18

def visit(node)
  type, rest = node
  public_send(:"visit_#{type}", rest)
end

#visit_nested(node) ⇒ 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.

API:

  • private



30
31
32
33
34
35
# File 'lib/dry/configurable/compiler.rb', line 30

def visit_nested(node)
  parent, children = node
  name, opts = parent[1]

  Setting.new(name, **opts, children: Settings.new(call(children)))
end

#visit_setting(node) ⇒ 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.

API:

  • private



24
25
26
27
# File 'lib/dry/configurable/compiler.rb', line 24

def visit_setting(node)
  name, opts = node
  Setting.new(name, **opts)
end