Class: Parse::Pointer
- Inherits:
-
Object
- Object
- Parse::Pointer
- Defined in:
- lib/parse/pointer.rb
Instance Method Summary collapse
-
#initialize(parse_client, parent_parse_class, parent_hash, parent_key, hash) ⇒ Pointer
constructor
A new instance of Pointer.
- #load(&block) ⇒ Object
Constructor Details
#initialize(parse_client, parent_parse_class, parent_hash, parent_key, hash) ⇒ Pointer
4 5 6 7 8 9 10 |
# File 'lib/parse/pointer.rb', line 4 def initialize parse_client, parent_parse_class, parent_hash, parent_key, hash @parse_client = parse_client @parent_parse_class = parent_parse_class @parent_hash = parent_hash @parent_key = parent_key @raw_hash = hash end |
Instance Method Details
#load(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/parse/pointer.rb', line 12 def load &block included_parse_class_name = @raw_hash['className'] mod = @parent_parse_class.name.include?('::') ? \ eval(@perent_parse_class.name.split('::')[0..-2]) : ::Object included_parse_class = Parse::Object included_parse_class_name, mod @parent_hash[@parent_key] = @parse_client.find( included_parse_class, @raw_hash['objectId']).tap do |real_value| if block block.call real_value end end end |