Class: Parse::Pointer
- Inherits:
-
Object
- Object
- Parse::Pointer
- Defined in:
- lib/parse/datatypes.rb
Overview
Pointer
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#parse_object_id ⇒ Object
Returns the value of attribute parse_object_id.
Instance Method Summary collapse
- #as_json(*a) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#get ⇒ Object
Retrieve the Parse object referenced by this pointer.
- #hash ⇒ Object
-
#initialize(data) ⇒ Pointer
constructor
A new instance of Pointer.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(data) ⇒ Pointer
Returns a new instance of Pointer.
12 13 14 15 |
# File 'lib/parse/datatypes.rb', line 12 def initialize(data) @class_name = data[Protocol::KEY_CLASS_NAME] @parse_object_id = data[Protocol::KEY_OBJECT_ID] end |
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
10 11 12 |
# File 'lib/parse/datatypes.rb', line 10 def class_name @class_name end |
#parse_object_id ⇒ Object
Returns the value of attribute parse_object_id.
9 10 11 |
# File 'lib/parse/datatypes.rb', line 9 def parse_object_id @parse_object_id end |
Instance Method Details
#as_json(*a) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/parse/datatypes.rb', line 29 def as_json(*a) { Protocol::KEY_TYPE => Protocol::TYPE_POINTER, Protocol::KEY_CLASS_NAME => @class_name, Protocol::KEY_OBJECT_ID => @parse_object_id } end |
#eql?(other) ⇒ Boolean Also known as: ==
17 18 19 20 21 |
# File 'lib/parse/datatypes.rb', line 17 def eql?(other) self.class.equal?(other.class) && class_name == other.class_name && parse_object_id == other.parse_object_id end |
#get ⇒ Object
Retrieve the Parse object referenced by this pointer.
42 43 44 |
# File 'lib/parse/datatypes.rb', line 42 def get Parse.get @class_name, @parse_object_id if @parse_object_id end |
#hash ⇒ Object
25 26 27 |
# File 'lib/parse/datatypes.rb', line 25 def hash class_name.hash ^ parse_object_id.hash end |
#to_json(*a) ⇒ Object
37 38 39 |
# File 'lib/parse/datatypes.rb', line 37 def to_json(*a) as_json.to_json(*a) end |