class Loom::Facts::FactFileProvider

Constants

ALL_FILE_GLOBS
InvalidFactFileConversion
TXT_FILE_GLOBS
YAML_FILE_GLOBS

Public Class Methods

new(paths) click to toggle source
# File lib/loom/facts/fact_file_provider.rb, line 35
def initialize(paths)
  @fact_map = convert_file_paths paths
end

Public Instance Methods

collect_facts() click to toggle source
# File lib/loom/facts/fact_file_provider.rb, line 39
def collect_facts
  @fact_map.dup
end

Protected Instance Methods

convert_path_to_map() click to toggle source
# File lib/loom/facts/fact_file_provider.rb, line 44
def convert_path_to_map
  raise 'not implemented'
end

Private Instance Methods

convert_file_paths(paths) click to toggle source
# File lib/loom/facts/fact_file_provider.rb, line 49
def convert_file_paths(paths)
  paths.reduce({}) do |memo, path|
    Loom.log.debug { "loading fact file provider for => #{path}" }
    tmp_map = convert_path_to_map path
    raise InvalidFactFileConversion, path unless tmp_map.is_a? Hash
    memo.merge! tmp_map
  end
end
load_config(config) click to toggle source
# File lib/loom/facts/fact_file_provider.rb, line 58
def load_config(config)
  file_paths = config.files.find @file_globs
end