Method: Pathname#read_json
- Defined in:
- lib/pleasant_path/json/pathname.rb
#read_json(options = {}) ⇒ nil, ...
Reads the file indicated by the Pathname, and parses the contents as JSON. The returned result will be composed of only basic data types, e.g. nil, true, false, Numeric, String, Array, and Hash.
For information about options, see JSON.parse. By default, this method uses JSON.load_default_options plus create_additions: false.
23 24 25 |
# File 'lib/pleasant_path/json/pathname.rb', line 23 def read_json( = {}) JSON.load(self, nil, { create_additions: false, ** }) end |