Class: Cassandra::Mocks::Statement::Arithmetic

Inherits:
Struct
  • Object
show all
Defined in:
lib/cassandra_mocks/statement/arithmetic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



4
5
6
# File 'lib/cassandra_mocks/statement/arithmetic.rb', line 4

def amount
  @amount
end

#columnObject

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



4
5
6
# File 'lib/cassandra_mocks/statement/arithmetic.rb', line 4

def column
  @column
end

#operationObject

Returns the value of attribute operation

Returns:

  • (Object)

    the current value of operation



4
5
6
# File 'lib/cassandra_mocks/statement/arithmetic.rb', line 4

def operation
  @operation
end

Instance Method Details

#apply(row) ⇒ Object



6
7
8
# File 'lib/cassandra_mocks/statement/arithmetic.rb', line 6

def apply(row)
  row.merge(column => (row[column] || 0).public_send(operator, amount))
end