Sha256: e3b8ad397a7fc91fcb46245f72c5ec2663118efa0085107be57ed3a59929ade8
Contents?: true
Size: 425 Bytes
Versions: 3
Compression:
Stored size: 425 Bytes
Contents
require "json" module FlatFile module JSON # Return a hash parsed from a given JSON file. # # @param file [String] # @return [Hash,ActiveSupport::HashWithIndifferentAccess] def self.from_file(file) data = ::JSON.parse(File.read(file)) if defined?(ActiveSupport::HashWithIndifferentAccess) return data&.with_indifferent_access || data end return data end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flat_file-0.3.0 | lib/flat_file/json.rb |
flat_file-0.2.0 | lib/flat_file/json.rb |
flat_file-0.1.0 | lib/flat_file/json.rb |