Class: Renogen::ExtractionStratagies::YamlFile::Reader
- Inherits:
-
Object
- Object
- Renogen::ExtractionStratagies::YamlFile::Reader
- Defined in:
- lib/renogen/extraction_stratagies/yaml_file/reader.rb
Overview
Reads the relevant yaml files
Instance Attribute Summary collapse
-
#directory_path ⇒ Object
Returns the value of attribute directory_path.
-
#legacy_version ⇒ Object
Returns the value of attribute legacy_version.
Instance Method Summary collapse
-
#each_yaml_file {|Hash| ... } ⇒ Object
Iterates thorugh each change file and yields the contents.
-
#initialize(directory_path, options = {}) ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize(directory_path, options = {}) ⇒ Reader
Returns a new instance of Reader.
10 11 12 13 14 |
# File 'lib/renogen/extraction_stratagies/yaml_file/reader.rb', line 10 def initialize(directory_path, ={}) @legacy_version = ['legacy_version'] @directory_path = directory_path @directory_path ||= './change_log/' end |
Instance Attribute Details
#directory_path ⇒ Object
Returns the value of attribute directory_path.
8 9 10 |
# File 'lib/renogen/extraction_stratagies/yaml_file/reader.rb', line 8 def directory_path @directory_path end |
#legacy_version ⇒ Object
Returns the value of attribute legacy_version.
8 9 10 |
# File 'lib/renogen/extraction_stratagies/yaml_file/reader.rb', line 8 def legacy_version @legacy_version end |
Instance Method Details
#each_yaml_file {|Hash| ... } ⇒ Object
Iterates thorugh each change file and yields the contents.
an exception is thrown if the contents are blank
21 22 23 24 25 26 27 |
# File 'lib/renogen/extraction_stratagies/yaml_file/reader.rb', line 21 def each_yaml_file change_directories.each do |file_path| content = ::YAML.load_file(file_path) raise Exceptions::YamlFileBlank.new(file_path) unless content yield content end end |