Module: Intercom::Traits::IncrementableAttributes

Included in:
Company, User
Defined in:
lib/intercom/traits/incrementable_attributes.rb

Instance Method Summary collapse

Instance Method Details

#increment(key, value = 1) ⇒ Object



5
6
7
8
9
# 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