Module: JSON

Defined in:
lib/coolkit/json.rb

Class Method Summary collapse

Class Method Details

.read(path, opts = {}) ⇒ Hash

Parse JSON data from a file at the given path.

TODO: Test this on ruby 2.7

Parameters:

  • path (String)
  • opts (Hash) (defaults to: {})

    Options to pass to [JSON.parse][2].

Returns:

  • (Hash)


13
14
15
# File 'lib/coolkit/json.rb', line 13

def self.read(path, opts = {})
  return self.parse(File.read(path), opts)
end