Class: Contur::Config::Use
- Inherits:
-
Hash
- Object
- Hash
- Contur::Config::Use
- Defined in:
- lib/contur/config/use.rb
Overview
Use section
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(using = {}) ⇒ Use
constructor
A new instance of Use.
- #name ⇒ Object
- #validate!(using) ⇒ Object
Constructor Details
#initialize(using = {}) ⇒ Use
Returns a new instance of Use.
16 17 18 19 20 21 22 23 |
# File 'lib/contur/config/use.rb', line 16 def initialize(using = {}) super replace(DEFAULTS) validate!(using) merge!(using) unless using.nil? end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
34 35 36 |
# File 'lib/contur/config/use.rb', line 34 def errors @errors end |
Instance Method Details
#name ⇒ Object
36 37 38 |
# File 'lib/contur/config/use.rb', line 36 def name "Section 'use'" end |
#validate!(using) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/contur/config/use.rb', line 25 def validate!(using) @errors = [] return unless using.respond_to? :keys extra_keys = using.keys - ALLOWED_VALUES extra_keys.each do |key| @errors << "Unknown key: #{key}" end end |