Class: Parse::Decrement
- Inherits:
-
Object
- Object
- Parse::Decrement
- Defined in:
- lib/parse/datatypes.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
‘{“score”: {“__op”: “Decrement”, “amount”: 1 } }’.
Instance Method Summary collapse
- #as_json(*a) ⇒ Object
-
#initialize(amount) ⇒ Decrement
constructor
A new instance of Decrement.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(amount) ⇒ Decrement
Returns a new instance of Decrement.
113 114 115 |
# File 'lib/parse/datatypes.rb', line 113 def initialize(amount) @amount = amount end |
Instance Attribute Details
#amount ⇒ Object
‘{“score”: {“__op”: “Decrement”, “amount”: 1 } }’
111 112 113 |
# File 'lib/parse/datatypes.rb', line 111 def amount @amount end |
Instance Method Details
#as_json(*a) ⇒ Object
117 118 119 120 121 122 |
# File 'lib/parse/datatypes.rb', line 117 def as_json(*a) { Protocol::KEY_OP => Protocol::KEY_DECREMENT, Protocol::KEY_AMOUNT => @amount } end |
#to_json(*a) ⇒ Object
124 125 126 |
# File 'lib/parse/datatypes.rb', line 124 def to_json(*a) as_json.to_json(*a) end |