Class: CHBuild::Config::Before
- Inherits:
-
Array
- Object
- Array
- CHBuild::Config::Before
- Defined in:
- lib/chbuild/config/before.rb
Overview
Before section
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(before_commands) ⇒ Before
constructor
before_commands is required so no default value.
- #name ⇒ Object
- #to_bash_script ⇒ Object
- #validate!(before_commands) ⇒ Object
Constructor Details
#initialize(before_commands) ⇒ Before
before_commands is required so no default value
7 8 9 10 11 |
# File 'lib/chbuild/config/before.rb', line 7 def initialize(before_commands) super([]) validate!(before_commands) replace(before_commands) unless before_commands.nil? end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
19 20 21 |
# File 'lib/chbuild/config/before.rb', line 19 def errors @errors end |
Instance Method Details
#name ⇒ Object
21 22 23 |
# File 'lib/chbuild/config/before.rb', line 21 def name "Section 'before'" end |
#to_bash_script ⇒ Object
25 26 27 |
# File 'lib/chbuild/config/before.rb', line 25 def to_bash_script reduce('') { |a, e| a + "#{e}\n" } end |
#validate!(before_commands) ⇒ Object
13 14 15 16 17 |
# File 'lib/chbuild/config/before.rb', line 13 def validate!(before_commands) @errors = [] @errors << 'Required' if before_commands.nil? @errors << 'Cannot be empty' if before_commands == [] end |