Class: CHBuild::Config::Use

Inherits:
Hash
  • Object
show all
Defined in:
lib/chbuild/config/use.rb

Overview

Use section

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(using = {}) ⇒ Use

Returns a new instance of Use.



16
17
18
19
20
21
22
23
# File 'lib/chbuild/config/use.rb', line 16

def initialize(using = {})
  super
  replace(DEFAULTS)

  validate!(using)

  merge!(using) unless using.nil?
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



35
36
37
# File 'lib/chbuild/config/use.rb', line 35

def errors
  @errors
end

Instance Method Details

#nameObject



37
38
39
# File 'lib/chbuild/config/use.rb', line 37

def name
  "Section 'use'"
end

#validate!(using) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/chbuild/config/use.rb', line 25

def validate!(using)
  @errors = []
  if using.respond_to? :keys
    extra_keys = using.keys - ALLOWED_VALUES
    extra_keys.each do |key|
      @errors << "Unknown key: #{key}"
    end
  end
end