Class: Customize::Formular
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Customize::Formular
- Defined in:
- app/models/customize/formular.rb
Instance Method Summary collapse
Instance Method Details
#calculator ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/models/customize/formular.rb', line 6 def calculator return unless calculator_name cal = calculator_name.constantize cal_ins = cal.new calculator_attributes.try :symbolize_keys! if calculator_attributes.respond_to? :symbolize_keys! names = (calculator_attributes.keys.map!(&:to_sym) & cal.inputs) if calculator_attributes names.each do |name| cal_ins.instance_variable_set "@#{name}", calculator_attributes[name] end if names cal_ins end |