Class: Parse::ArrayOp

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

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, objects) ⇒ ArrayOp

Returns a new instance of ArrayOp.



210
211
212
213
# File 'lib/parse/datatypes.rb', line 210

def initialize(operation, objects)
  @operation = operation
  @objects = objects
end

Instance Attribute Details

#objectsObject

Returns the value of attribute objects.



208
209
210
# File 'lib/parse/datatypes.rb', line 208

def objects
  @objects
end

#operationObject

Returns the value of attribute operation.



207
208
209
# File 'lib/parse/datatypes.rb', line 207

def operation
  @operation
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


215
216
217
218
219
# File 'lib/parse/datatypes.rb', line 215

def eql?(other)
  self.class.equal?(other.class) &&
    operation == other.operation &&
    objects == other.objects
end

#hashObject



222
223
224
# File 'lib/parse/datatypes.rb', line 222

def hash
  operation.hash ^ objects.hash
end

#to_h(*_a) ⇒ Object Also known as: as_json



226
227
228
229
230
231
# File 'lib/parse/datatypes.rb', line 226

def to_h(*_a)
  {
    Protocol::KEY_OP => operation,
    Protocol::KEY_OBJECTS => @objects
  }
end

#to_json(*a) ⇒ Object



234
235
236
# File 'lib/parse/datatypes.rb', line 234

def to_json(*a)
  to_h.to_json(*a)
end