class Backframe::Response::Record

Public Class Methods

cast_path(path) click to toggle source
# File lib/backframe/response/record.rb, line 22
def cast_path(path)
  if path.is_a?(String)
    path.split(".")
  elsif path.is_a?(Symbol)
    path.to_s.split(".")
  elsif path.is_a?(Array)
    path
  end
end
get_value(record, path) click to toggle source
# File lib/backframe/response/record.rb, line 11
def get_value(record, path)
  path = cast_path(path)
  index = 0
  length = path.length
  while record != nil && index < length
    record = record.with_indifferent_access[path[index]]
    index += 1
  end
  record
end