module Ruson::Json

Public Instance Methods

get_hash_from_json(json) click to toggle source
# File lib/ruson/json.rb, line 3
def get_hash_from_json(json)
  return unless json
  return json if json.class == ActiveSupport::HashWithIndifferentAccess

  (json.class == Hash ? json : JSON.parse(json)).with_indifferent_access
end
id_from_file_path(path) click to toggle source

Returns the ID from the JSON file path.

# File lib/ruson/json.rb, line 13
def id_from_file_path(path)
  File.basename(path, '.json').to_i
end