class Parsed::ParsesJson

Public Class Methods

parse(data) click to toggle source
# File lib/parsed/parses_json.rb, line 6
def self.parse(data)
  return data if data.instance_of? Hash

  JSON.parse(data, { :symbolize_names => true })
end
parse_elements(data, field) click to toggle source
# File lib/parsed/parses_json.rb, line 16
def self.parse_elements(data, field)
  data[field.to_sym] || []
end
parse_value(data, field) click to toggle source
# File lib/parsed/parses_json.rb, line 12
def self.parse_value(data, field)
  data[field.to_sym]
end