Module: AbstractMapper::DSL Private

Included in:
AbstractMapper
Defined in:
lib/abstract_mapper/dsl.rb

Overview

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

Provides features to configure mappers

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)

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.



56
57
58
# File 'lib/abstract_mapper/dsl.rb', line 56

def method_missing(name, *args, &block)
  @tree = settings.builder.update(tree) { public_send(name, *args, &block) }
end

Instance Attribute Details

#settingsAbstractMapper::Settings (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.

Returns The configurable container of domain-specific settings (DSL commands and optimization rules along with corresponding AST builder and optimizer).

Returns:

  • (AbstractMapper::Settings)

    The configurable container of domain-specific settings (DSL commands and optimization rules along with corresponding AST builder and optimizer).



23
24
25
# File 'lib/abstract_mapper/dsl.rb', line 23

def settings
  @settings
end

Instance Method Details

#configure(&block) { ... } ⇒ self

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.

Configures domain-specific settings

Parameters:

  • block (Proc)

    The block where rules and commands to be registered

Yields:

  • a block

Returns:

  • (self)

    itself



33
34
35
36
# File 'lib/abstract_mapper/dsl.rb', line 33

def configure(&block)
  @settings = settings ? settings.update(&block) : Settings.new(&block)
  self
end

#finalizeAbstractMapper::Branch

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 the optimized AST

Returns:

  • (AbstractMapper::Branch)


42
43
44
# File 'lib/abstract_mapper/dsl.rb', line 42

def finalize
  settings.optimizer.update(tree)
end

#inherited(klass) ⇒ 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.



12
13
14
# File 'lib/abstract_mapper/dsl.rb', line 12

def inherited(klass)
  klass.instance_variable_set :@settings, settings
end