class Grayskull::Formats::JSONHandler
Handler for JSON file format.
Public Class Methods
load(file)
click to toggle source
Loads the JSON file and parses it into a ruby type.
Raises an expection if file can not be parsed.
# File lib/grayskull/formats/json_handler.rb, line 13 def self.load(file) loaded = File.open(file) content = loaded.gets nil begin return JSON.parse(content) rescue Exception => e raise e.class, 'File could not be parsed as valid JSON' end end