class PIM::CalculationContext
Attributes
attribute[R]
dependent_attributes[R]
Public Class Methods
new(formula, attribute, dependent_attributes, new_item)
click to toggle source
# File pim.rb, line 9460 def initialize formula, attribute, dependent_attributes, new_item @formula = formula @attribute = attribute @dependent_attributes = dependent_attributes @new_item = new_item end
Public Instance Methods
any_item_value(name)
click to toggle source
# File pim.rb, line 9475 def any_item_value name raise "'name' must not be nil" if name.nil? return PIM.get_value(@new_item, name) end
value(name = nil)
click to toggle source
# File pim.rb, line 9467 def value name = nil name = (name || @attribute).to_sym if not @dependent_attributes.include?(name) and @attribute != name raise "'#{@formula.calculated_attribute}' does not depend on '#{name}'. Access is restricted to dependent attributes for calculations." end return @new_item[name] end