Class: CHBuild::Config::Version
- Inherits:
-
Object
- Object
- CHBuild::Config::Version
- Defined in:
- lib/chbuild/config/version.rb
Overview
Version section
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
version is required so no default value.
- #inspect ⇒ Object
- #name ⇒ Object
- #validate!(version) ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
version is required so no default value
9 10 11 12 |
# File 'lib/chbuild/config/version.rb', line 9 def initialize(version) validate!(version) @yaml_version = version end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
27 28 29 |
# File 'lib/chbuild/config/version.rb', line 27 def errors @errors end |
Instance Method Details
#inspect ⇒ Object
14 15 16 |
# File 'lib/chbuild/config/version.rb', line 14 def inspect @yaml_version.to_s end |
#name ⇒ Object
29 30 31 |
# File 'lib/chbuild/config/version.rb', line 29 def name "Section 'version'" end |
#validate!(version) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/chbuild/config/version.rb', line 18 def validate!(version) @errors = [] if version.nil? @errors << 'Required' return end @errors << "Unknown value: '#{version}'" unless ALLOWED_VALUES.include? version end |