Class: Tdc::YamlReaders::YamlReaderFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/tdc/yaml_readers/yaml_reader_factory.rb

Overview

Knows how to create the appropriate YAML reader.

Instance Method Summary collapse

Constructor Details

#initialize(catalog_root_directory, path_elements) ⇒ YamlReaderFactory

Returns a new instance of YamlReaderFactory.



7
8
9
10
# File 'lib/tdc/yaml_readers/yaml_reader_factory.rb', line 7

def initialize(catalog_root_directory, path_elements)
  @catalog_root_directory = catalog_root_directory
  @path_elements = path_elements
end

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
# File 'lib/tdc/yaml_readers/yaml_reader_factory.rb', line 12

def create
  if yaml_reader_with_expansion.applies?
    yaml_reader_with_expansion
  elsif yaml_reader.applies?
    yaml_reader
  else
    null_reader
  end
end