Sha256: d27fb0c461710eb24b373d73f3628e602c90e3eee05c501e4cbd9b094d9709c6

Contents?: true

Size: 500 Bytes

Versions: 3

Compression:

Stored size: 500 Bytes

Contents

module JSON
  # Parse JSON data from a file at the given path.
  #
  # TODO: Test this on [ruby 2.7][1]
  #
  # @param path [String]
  # @param opts [Hash] Options to pass to [`JSON.parse`][2].
  # @param (see #parse)
  # @return [Hash]
  #
  # [1]: https://blog.saeloun.com/2019/10/07/ruby-2-7-keyword-arguments-redesign.html
  # [2]: https://ruby-doc.org/stdlib-2.6.3/libdoc/json/rdoc/JSON.html#method-i-parse
  def self.read(path, opts = {})
    return self.parse(File.read(path), opts)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coolkit-0.2.2 lib/coolkit/json.rb
coolkit-0.2.1 lib/coolkit/json.rb
coolkit-0.2.0 lib/coolkit/json.rb