Class: Loom::Facts::TxtFileProvider

Inherits:
FactFileProvider show all
Defined in:
lib/loom/facts/fact_file_provider.rb

Constant Summary

Constants inherited from FactFileProvider

FactFileProvider::ALL_FILE_GLOBS, FactFileProvider::InvalidFactFileConversion, FactFileProvider::TXT_FILE_GLOBS, FactFileProvider::YAML_FILE_GLOBS

Instance Attribute Summary

Attributes inherited from Provider

#fact_map, #namespace

Instance Method Summary collapse

Methods inherited from FactFileProvider

#collect_facts, #initialize

Methods inherited from Provider

#collect_facts, create_fact_providers, #disable, disable_for_host, disabled_for_host?, register_factory

Constructor Details

This class inherits a constructor from Loom::Facts::FactFileProvider

Instance Method Details

#convert_path_to_map(path) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/loom/facts/fact_file_provider.rb', line 73

def convert_path_to_map(path)
  map = {}
  File.open(path, 'r') do |io|
    io.each_line do |line|
      next if line.match /^\s*#/
      k,v = line.split "="
      map[k] = v.strip
    end
    map
  end
end