Module: Aker::ConfiguratorLanguage

Included in:
Configurator
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
  {Configuration#parameters_for parameters} for group *name*.
* Also as shown in the example, there is sugar for calling
  {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
}

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



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

Instance Method Details

#authorities(*authorities) ⇒ Object Also known as: authority



483
484
485
# File 'lib/aker/configuration.rb', line 483

def authorities(*authorities)
  @specified_authorities = authorities
end

#deferred_setupObject



512
513
514
# File 'lib/aker/configuration.rb', line 512

def deferred_setup
  @config.authorities = @specified_authorities if @specified_authorities
end

#thisObject



506
507
508
# File 'lib/aker/configuration.rb', line 506

def this
  @config
end