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.
  • this refers to the configuration being updated (for the rare case that you would need to pass it directly to some constructor).

Examples:

Aker.configure {
  portal :ENU
  authorities :ldap, :static
  api_mode :http_basic
  central "/etc/nubic/aker-prod.yml"
  ldap_parameters :server => 'ldap.example.org'
  after_authentication_middleware do |builder|
    builder.use RequestLogger
  end
}

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