Module: Configurations::Strict

Defined in:
lib/configurations/strict.rb

Overview

StrictConfiguration is a blank object with setters and getters defined according to the configurable settings given

Instance Method Summary collapse

Instance Method Details

#__configurable?(property) ⇒ Boolean

Returns whether the given property is configurable.

Parameters:

  • property (Symbol)

    The property to test for configurability

Returns:

  • (Boolean)

    whether the given property is configurable



28
29
30
31
# File 'lib/configurations/strict.rb', line 28

def __configurable?(property)
  @__configurable__.key?(property) ||
    @__nested_configurables__.key?(property)
end

#initialize(options = {}, &block) {|HostModule::Configuration| ... } ⇒ HostModule::Configuration

Initialize a new configuration

Parameters:

  • options (Hash) (defaults to: {})

    The options to initialize a configuration with

  • block (Proc)

    a block to configure this configuration with

Options Hash (options):

  • configurable (Hash)

    a hash of configurable properties and their asserted types if given

  • methods (Hash)

    a hash of method names pointing to procs

  • not_configured (Proc)

    a proc to evaluate for not_configured properties

Yields:

  • (HostModule::Configuration)

    a configuration

Returns:

  • (HostModule::Configuration)

    a configuration



18
19
20
21
22
23
# File 'lib/configurations/strict.rb', line 18

def initialize(options = {}, &block)
  @__configurable__   = options.fetch(:configurable)
  __evaluate_configurable!

  super
end