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
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ 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.
163 164 165 |
# File 'lib/parse/datatypes.rb', line 163 def initialize(amount) @amount = amount end |
Instance Attribute Details
#amount ⇒ Object
‘{“score”: {“__op”: “Increment”, “amount”: 1 } }’
161 162 163 |
# File 'lib/parse/datatypes.rb', line 161 def amount @amount end |
Instance Method Details
#as_json(*a) ⇒ Object
178 179 180 181 182 183 |
# File 'lib/parse/datatypes.rb', line 178 def as_json(*a) { Protocol::KEY_OP => Protocol::KEY_INCREMENT, Protocol::KEY_AMOUNT => @amount } end |
#eql?(other) ⇒ Boolean Also known as: ==
167 168 169 170 |
# File 'lib/parse/datatypes.rb', line 167 def eql?(other) self.class.equal?(other.class) && amount == other.amount end |
#hash ⇒ Object
174 175 176 |
# File 'lib/parse/datatypes.rb', line 174 def hash amount.hash end |
#to_json(*a) ⇒ Object
185 186 187 |
# File 'lib/parse/datatypes.rb', line 185 def to_json(*a) as_json.to_json(*a) end |