class LC::Increment
Increment
and Decrement
Attributes
amount[RW]
'{“score”: {“__op”: “Increment”, “amount”: 1 } }'
Public Class Methods
new(amount)
click to toggle source
# File lib/leancloud/datatypes.rb, line 185 def initialize(amount) @amount = amount end
Public Instance Methods
eql?(other)
click to toggle source
# File lib/leancloud/datatypes.rb, line 189 def eql?(other) self.class.equal?(other.class) && amount == other.amount end
Also aliased as: ==
hash()
click to toggle source
# File lib/leancloud/datatypes.rb, line 196 def hash amount.hash end
to_h(*a)
click to toggle source
# File lib/leancloud/datatypes.rb, line 200 def to_h(*a) { Protocol::KEY_OP => Protocol::KEY_INCREMENT, Protocol::KEY_AMOUNT => @amount } end
Also aliased as: as_json
to_json(*a)
click to toggle source
# File lib/leancloud/datatypes.rb, line 208 def to_json(*a) to_h.to_json(*a) end