Class: Parse::Increment
- Inherits:
-
Object
- Object
- Parse::Increment
- Defined in:
- lib/parse/datatypes.rb
Overview
Increment and Decrement
Instance Attribute Summary collapse
-
#amount ⇒ Object
‘{“score”: {“__op”: “Increment”, “amount”: 1 } }’.
Instance Method Summary collapse
- #as_json(*a) ⇒ Object
-
#initialize(amount) ⇒ Increment
constructor
A new instance of Increment.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(amount) ⇒ Increment
Returns a new instance of Increment.
93 94 95 |
# File 'lib/parse/datatypes.rb', line 93 def initialize(amount) @amount = amount end |
Instance Attribute Details
#amount ⇒ Object
‘{“score”: {“__op”: “Increment”, “amount”: 1 } }’
91 92 93 |
# File 'lib/parse/datatypes.rb', line 91 def amount @amount end |
Instance Method Details
#as_json(*a) ⇒ Object
97 98 99 100 101 102 |
# File 'lib/parse/datatypes.rb', line 97 def as_json(*a) { Protocol::KEY_OP => Protocol::KEY_INCREMENT, Protocol::KEY_AMOUNT => @amount } end |
#to_json(*a) ⇒ Object
104 105 106 |
# File 'lib/parse/datatypes.rb', line 104 def to_json(*a) as_json.to_json(*a) end |