Class: Contur::Config::Before

Inherits:
Array
  • Object
show all
Defined in:
lib/contur/config/before.rb

Overview

Before section

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before_commands = []) ⇒ Before

Returns a new instance of Before.



6
7
8
9
10
# File 'lib/contur/config/before.rb', line 6

def initialize(before_commands = [])
  super([])
  validate!(before_commands)
  replace(before_commands) unless before_commands.nil?
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



16
17
18
# File 'lib/contur/config/before.rb', line 16

def errors
  @errors
end

Instance Method Details

#nameObject



18
19
20
# File 'lib/contur/config/before.rb', line 18

def name
  "Section 'before'"
end

#to_bash_scriptObject



22
23
24
# File 'lib/contur/config/before.rb', line 22

def to_bash_script
  reduce('') { |a, e| a + "#{e}\n" }
end

#validate!(_before_commands) ⇒ Object



12
13
14
# File 'lib/contur/config/before.rb', line 12

def validate!(_before_commands)
  @errors = []
end