Class: Unfig::ParamsConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/unfig/params_config.rb

Overview

ParamsConfig wraps the configuration of all of the possible parameters, and enforces uniqueness validations - you can't have two parameters with the same flag, or the same name; they'll collide in the implementation.

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ParamsConfig

Returns a new instance of ParamsConfig.

Raises:



6
7
8
9
10
# File 'lib/unfig/params_config.rb', line 6

def initialize(data)
  raise(Invalid, "Params-config must be a Hash") unless data.is_a?(Hash)
  raise(Invalid, "Params-config must supply some params (as a Hash)") unless data[:params].is_a?(Hash)
  @data = data
end

Instance Method Details



18
# File 'lib/unfig/params_config.rb', line 18

def banner = data[:banner]

#paramsObject



12
13
14
15
16
# File 'lib/unfig/params_config.rb', line 12

def params
  return @_params if defined?(@_params)
  validate!
  @_params = built
end