module FlatFile::JSON
Public Class Methods
from_file(file)
click to toggle source
Return a hash parsed from a given JSON
file.
@param file [String] @return [Hash,ActiveSupport::HashWithIndifferentAccess]
# File lib/flat_file/json.rb, line 10 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