Class: Roject::Parsers::JSONParser
Overview
Parses JSON files
Author: Anshul Kharbanda Created: 7 - 11 - 2016
Constant Summary
Constants inherited from Parser
Class Method Summary collapse
-
.format(hash) ⇒ Object
Returns the given hash formatted to pretty json.
-
.parse(text) ⇒ Object
Parses the given json text into a hash.
Methods inherited from Parser
Class Method Details
.format(hash) ⇒ Object
Returns the given hash formatted to pretty json
Parameter: hash - the hash to format
Return: the given hash formatted to pretty json
73 |
# File 'lib/parsers.rb', line 73 def self.format(hash); JSON.pretty_generate hash, indent: "\t"; end |
.parse(text) ⇒ Object
Parses the given json text into a hash
Parameter: text - the json text to parse
Return: the hash parsed from the text
66 |
# File 'lib/parsers.rb', line 66 def self.parse(text); JSON.parse text, symbolize_names: true; end |