Class: CalculatedAttributes::CalculatedAttributes::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/calculated_attributes/model_methods.rb

Instance Method Summary collapse

Instance Method Details

#calculated(title = nil, lambda = nil) ⇒ Object



10
11
12
13
14
# File 'lib/calculated_attributes/model_methods.rb', line 10

def calculated(title = nil, lambda = nil)
  @calculations ||= {}
  @calculations[title] ||= lambda if title && lambda
  @calculations
end