class LC::Pointer
Attributes
class_name[RW]
id[RW]
parse_object_id[RW]
Public Class Methods
make(class_name, object_id)
click to toggle source
# File lib/leancloud/datatypes.rb, line 15 def self.make(class_name, object_id) Pointer.new( Protocol::KEY_CLASS_NAME => class_name, Protocol::KEY_OBJECT_ID => object_id ) end
new(data)
click to toggle source
# File lib/leancloud/datatypes.rb, line 22 def initialize(data) @class_name = data[Protocol::KEY_CLASS_NAME] @parse_object_id = data[Protocol::KEY_OBJECT_ID] end
Public Instance Methods
eql?(other)
click to toggle source
# File lib/leancloud/datatypes.rb, line 32 def eql?(other) LC.object_pointer_equality?(self, other) end
Also aliased as: ==
get()
click to toggle source
Retrieve the Parse object referenced by this pointer.
# File lib/leancloud/datatypes.rb, line 60 def get LC.get @class_name, @parse_object_id if @parse_object_id end
hash()
click to toggle source
# File lib/leancloud/datatypes.rb, line 38 def hash LC.object_pointer_hash(self) end
new?()
click to toggle source
# File lib/leancloud/datatypes.rb, line 42 def new? false end
pointer()
click to toggle source
make it easier to deal with the ambiguity of whether you're passed a pointer or object
# File lib/leancloud/datatypes.rb, line 28 def pointer self end
to_h(*a)
click to toggle source
# File lib/leancloud/datatypes.rb, line 46 def to_h(*a) { Protocol::KEY_TYPE => Protocol::TYPE_POINTER, Protocol::KEY_CLASS_NAME => @class_name, Protocol::KEY_OBJECT_ID => @parse_object_id } end
Also aliased as: as_json
to_json(*a)
click to toggle source
# File lib/leancloud/datatypes.rb, line 55 def to_json(*a) to_h.to_json(*a) end
to_s()
click to toggle source
# File lib/leancloud/datatypes.rb, line 64 def to_s "#{@class_name}:#{@parse_object_id}" end