Sha256: a530911f8e5a4aab4bbc05baa24cf1569a6a9dc09b8e2fccd02b193d93f19340

Contents?: true

Size: 410 Bytes

Versions: 26

Compression:

Stored size: 410 Bytes

Contents

module Datapimp
  module Util
    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
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
datapimp-1.0.23 lib/datapimp/util.rb
datapimp-1.0.22 lib/datapimp/util.rb
datapimp-1.0.21 lib/datapimp/util.rb
datapimp-1.0.20 lib/datapimp/util.rb
datapimp-1.0.15 lib/datapimp/util.rb
datapimp-1.0.14 lib/datapimp/util.rb