Module: Aker::ConfiguratorLanguage
- Defined in:
- lib/aker/configuration.rb
Overview
This module provides a DSL adapter for Configuration.
Notes:
- All setters in Configuration are accessible from the DSL, except that you don't use '='.
- Other methods which accept arguments are also available.
- As shown in the example, there is sugar for setting other parameters. "name_parameters hash" adds to the parameters for group name.
- Also as shown in the example, there is sugar for calling Aker::Configuration#register_middleware_installer.
thisrefers to the configuration being updated (for the rare case that you would need to pass it directly to some constructor).
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(m, *args, &block)
490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'lib/aker/configuration.rb', line 490 def method_missing(m, *args, &block) if m.to_s =~ /(\S+)_parameters?$/ @config.add_parameters_for($1.to_sym, args.first) elsif m.to_s =~/(\S+)_middleware$/ @config.register_middleware_installer($1.to_sym, &block) elsif @config.respond_to?(:#{m}=") @config.send(:#{m}=", *args) elsif @config.respond_to?(m) @config.send(m, *args) else super end end |