Class: Unfig::ParamsConfig
- Inherits:
-
Object
- Object
- Unfig::ParamsConfig
- 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
- #banner ⇒ Object
-
#initialize(data) ⇒ ParamsConfig
constructor
A new instance of ParamsConfig.
- #params ⇒ Object
Constructor Details
#initialize(data) ⇒ ParamsConfig
Returns a new instance of ParamsConfig.
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
#banner ⇒ Object
18 |
# File 'lib/unfig/params_config.rb', line 18 def = data[:banner] |
#params ⇒ Object
12 13 14 15 16 |
# File 'lib/unfig/params_config.rb', line 12 def params return @_params if defined?(@_params) validate! @_params = built end |