Module: Optionable::DSL

Defined in:
lib/optionable/dsl.rb

Overview

Provides the entry point to the optionable DSL.

Since:

  • 0.0.0

Instance Method Summary collapse

Instance Method Details

#option(key) ⇒ Optionable::Validator

Defines an option to be validated.

Examples:

Define the option.

option(:read).allow(:primary, :secondary)

Parameters:

  • key (Symbol)

    The name of the option.

Returns:

Since:

  • 0.0.0



19
20
21
# File 'lib/optionable/dsl.rb', line 19

def option(key)
  optionable_validators[key] ||= Validator.new(key)
end

#optionable_validatorsHash<Symbol, Optionable::Validator>

Get all the validators for all options.

Examples:

Get all the validators.

dsl.optionable_validators

Returns:

Since:

  • 0.0.0



31
32
33
# File 'lib/optionable/dsl.rb', line 31

def optionable_validators
  @optionable_validators ||= {}
end