Class: Parse::Increment

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/datatypes.rb

Overview

Increment and Decrement


Instance Attribute Summary collapse

Instance Method Summary collapse

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

#amountObject

‘{“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