module Intercom::Traits::IncrementableAttributes

Public Instance Methods

decrement(key, value=1) click to toggle source
# File lib/intercom/traits/incrementable_attributes.rb, line 11
def decrement(key, value=1)
  existing_value = self.custom_attributes[key] || 0
  self.custom_attributes[key] = existing_value - value
end
increment(key, value=1) click to toggle source
# File lib/intercom/traits/incrementable_attributes.rb, line 5
def increment(key, value=1)
  existing_value = self.custom_attributes[key]
  existing_value ||= 0
  self.custom_attributes[key] = existing_value + value
end