Class: Diakonos::ConfigFile
- Includes:
- ConfigFileDescription
- Defined in:
- lib/diakonos/config-file.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#problems ⇒ Object
Returns the value of attribute problems.
Instance Method Summary collapse
- #==(other_config_file) ⇒ Object
- #each_line_with_index ⇒ Object
-
#initialize(filename, including_config_file) ⇒ ConfigFile
constructor
A new instance of ConfigFile.
Methods included from ConfigFileDescription
#inclusion_description, #name_as_includer, #to_s
Constructor Details
#initialize(filename, including_config_file) ⇒ ConfigFile
Returns a new instance of ConfigFile.
24 25 26 27 |
# File 'lib/diakonos/config-file.rb', line 24 def initialize(filename, including_config_file) @filename, @including_config_file = filename, including_config_file @problems = [] end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
19 20 21 |
# File 'lib/diakonos/config-file.rb', line 19 def filename @filename end |
#problems ⇒ Object
Returns the value of attribute problems.
20 21 22 |
# File 'lib/diakonos/config-file.rb', line 20 def problems @problems end |
Instance Method Details
#==(other_config_file) ⇒ Object
29 30 31 |
# File 'lib/diakonos/config-file.rb', line 29 def ==(other_config_file) @filename == other_config_file.filename end |
#each_line_with_index ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/diakonos/config-file.rb', line 33 def each_line_with_index # TODO: Refactor line_number into index, then +1 before yielding IO.readlines(@filename).each_with_index do |line, line_number| line.chomp! # Skip comments next if line[0] == ?# yield line, line_number end end |