class Tdc::YamlReaders::YamlReaderFactory

Knows how to create the appropriate YAML reader.

Public Class Methods

new(catalog_root_directory, path_elements) click to toggle source
# 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

Public Instance Methods

create() click to toggle source
# 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

Private Instance Methods

null_reader() click to toggle source
# File lib/tdc/yaml_readers/yaml_reader_factory.rb, line 29
def null_reader
  @_null_reader ||= Tdc::YamlReaders::NullYamlReader.new
end
yaml_reader() click to toggle source
# File lib/tdc/yaml_readers/yaml_reader_factory.rb, line 33
def yaml_reader
  @_yaml_reader ||= Tdc::YamlReaders::YamlReader.new(@catalog_root_directory, @path_elements)
end
yaml_reader_with_expansion() click to toggle source
# File lib/tdc/yaml_readers/yaml_reader_factory.rb, line 24
def yaml_reader_with_expansion
  @_yaml_reader_with_expansion ||=
    Tdc::YamlReaders::YamlReaderWithExpansion.new(@catalog_root_directory, @path_elements)
end