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
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ 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.
194 195 196 |
# File 'lib/parse/datatypes.rb', line 194 def initialize(amount) @amount = amount end |
Instance Attribute Details
#amount ⇒ Object
‘{“score”: {“__op”: “Decrement”, “amount”: 1 } }’
192 193 194 |
# File 'lib/parse/datatypes.rb', line 192 def amount @amount end |
Instance Method Details
#as_json(*a) ⇒ Object
209 210 211 212 213 214 |
# File 'lib/parse/datatypes.rb', line 209 def as_json(*a) { Protocol::KEY_OP => Protocol::KEY_DECREMENT, Protocol::KEY_AMOUNT => @amount } end |
#eql?(other) ⇒ Boolean Also known as: ==
198 199 200 201 |
# File 'lib/parse/datatypes.rb', line 198 def eql?(other) self.class.equal?(other.class) && amount == other.amount end |
#hash ⇒ Object
205 206 207 |
# File 'lib/parse/datatypes.rb', line 205 def hash amount.hash end |
#to_json(*a) ⇒ Object
216 217 218 |
# File 'lib/parse/datatypes.rb', line 216 def to_json(*a) as_json.to_json(*a) end |