Module: ConfigSL::DSL::ClassMethods

Defined in:
lib/configsl/dsl.rb

Overview

Required class methods for the config DSL.

Instance Method Summary collapse

Instance Method Details

#option(name, opts = {}) ⇒ void

This method returns an undefined value.

Define an option for the class.

The keys for the options hash will vary depending on the modules that have been included in your class.

Parameters:

  • name (Symbol)

    The name of the option.

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

    The options for the option.



99
100
101
102
103
104
# File 'lib/configsl/dsl.rb', line 99

def option(name, opts = {})
  options[name] = opts

  define_method(name) { get_value(name) }
  define_method("#{name}=") { |val| set_value(name, val) }
end

#optionsHash

Returns the options hash for the class.

Returns:

  • (Hash)

    The options hash.



109
110
111
# File 'lib/configsl/dsl.rb', line 109

def options
  @options ||= {}
end