module WCC::API::ActiveRecordShim::InstanceMethods

Public Instance Methods

attributes() click to toggle source
# File lib/wcc/api/active_record_shim.rb, line 8
def attributes
  raw.keys.each_with_object({}) do |key, h|
    next unless respond_to?(key)

    val = public_send(key)
    h[key] =
      if val.is_a? Array
        val.map { |v| v.respond_to?(:to_h) ? v.to_h : v }
      else
        val.respond_to?(:to_h) ? val.to_h : val
      end
  end
end