Module: Datapimp::Util
- Defined in:
- lib/datapimp/util.rb
Class Method Summary collapse
Class Method Details
.load_config_file(at_path) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/datapimp/util.rb', line 3 def self.load_config_file(at_path) at_path = Pathname(at_path) extension = at_path.extname.to_s.downcase raise 'No config file exists at: ' + at_path.to_s unless at_path.exist? if extension == '.yml' || extension == '.yaml' YAML.load_file(at_path) elsif extension == '.json' JSON.parse(at_path.read) end end |