Method: Array#parse_objects

Defined in:
lib/parse/model/object.rb

#parse_objects(className = nil) ⇒ Array<Parse::Object>

This helper method selects or converts all objects in an array that are either inherit from Parse::Pointer or are a JSON Parse hash. If it is a hash, a Pare::Object will be built from it if it constains the proper fields. Non-convertible objects will be removed. If the className is not contained or known, you can pass a table name as an argument

Parameters:

  • className (String) (defaults to: nil)

    the name of the Parse class if it could not be detected.

Returns:



553
554
555
556
557
558
559
560
561
562
# File 'lib/parse/model/object.rb', line 553

def parse_objects(className = nil)
  f = Parse::Model::KEY_CLASS_NAME
  map do |m|
    next m if m.is_a?(Parse::Pointer)
    if m.is_a?(Hash) && (m[f] || m[:className] || className)
      next Parse::Object.build m, (m[f] || m[:className] || className)
    end
    nil
  end.compact
end