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
-
#initialize(amount) ⇒ Increment
constructor
A new instance of Increment.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(amount) ⇒ Increment
Returns a new instance of Increment.
81 82 83 |
# File 'lib/parse/datatypes.rb', line 81 def initialize(amount) @amount = amount end |
Instance Attribute Details
#amount ⇒ Object
‘{“score”: {“__op”: “Increment”, “amount”: 1 } }’
79 80 81 |
# File 'lib/parse/datatypes.rb', line 79 def amount @amount end |
Instance Method Details
#to_json(*a) ⇒ Object
85 86 87 88 89 90 |
# File 'lib/parse/datatypes.rb', line 85 def to_json(*a) { Protocol::KEY_OP => Protocol::KEY_INCREMENT, Protocol::KEY_AMOUNT => @amount }.to_json(*a) end |