Class: Grayskull::DataFile

Inherits:
Object
  • Object
show all
Defined in:
lib/grayskull/datafile.rb

Overview

The DataFile class contains methods for loading and working with the supported data files.

Class Method Summary collapse

Class Method Details

.load(file) ⇒ Object

Loads the specified file depending on the format



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grayskull/datafile.rb', line 8

def self.load(file)
 
  format = Formats::detect_format File.basename(file)
 
  case format
    when 'yaml'
      return Formats::YAMLHandler.load(file)
    when 'json'
      return Formats::JSONHandler.load(file)
   end
   
end