Class: Parse::Object
- Inherits:
-
Pointer
- Object
- Pointer
- Parse::Object
- Defined in:
- lib/parse/stack/async.rb
Overview
Additions to the Parse::Object class.
Instance Method Summary collapse
-
#destroy_eventually {|success| ... } ⇒ Boolean
(also: #delete_eventually)
Adds support for deleting a Parse object in the background.
-
#save_eventually {|success| ... } ⇒ Boolean
Adds support for saving a Parse object in the background.
Instance Method Details
#destroy_eventually {|success| ... } ⇒ Boolean Also known as: delete_eventually
Adds support for deleting a Parse object in the background.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/parse/stack/async.rb', line 92 def destroy_eventually block = block_given? ? Proc.new : nil _self = self Parse::Stack::Async.run do begin result = true _self.destroy rescue => e result = false puts "[DestroyEventually] Failed for object #{_self.parse_class}##{_self.id}: #{e}" ensure block.call(result) if block block = nil _self = nil end # begin end # do end |
#save_eventually {|success| ... } ⇒ Boolean
Adds support for saving a Parse object in the background.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/parse/stack/async.rb', line 66 def save_eventually block = block_given? ? Proc.new : nil _self = self Parse::Stack::Async.run do begin result = true _self.save! rescue => e result = false puts "[SaveEventually] Failed for object #{_self.parse_class}##{_self.id}: #{e}" ensure block.call(result) if block block = nil _self = nil end # begin end # do end |