Class: Item::HeatingElementLine
- Inherits:
-
Object
- Object
- Item::HeatingElementLine
- Includes:
- ActiveModel::API, ActiveModel::Attributes, ActiveModel::Validations::Callbacks, StripAttributes
- Defined in:
- app/services/item/heating_element_line.rb
Overview
Service object: heating element line.
Instance Method Summary collapse
- #imperial_cold_lead_length ⇒ Object
- #imperial_length ⇒ Object
-
#imperial_width ⇒ Object
Renders width in plain inches if < 12 or converts to feet and inches notation.
- #merge_by_length(other_heating_element_line) ⇒ Object
- #volts_with_alternative_volts(alternative_volts_explanation) ⇒ Object
Instance Method Details
#imperial_cold_lead_length ⇒ Object
33 34 35 36 37 |
# File 'app/services/item/heating_element_line.rb', line 33 def imperial_cold_lead_length return nil if cold_lead_length.nil? UnitConversions.inches_to_feetinches(cold_lead_length) end |
#imperial_length ⇒ Object
29 30 31 |
# File 'app/services/item/heating_element_line.rb', line 29 def imperial_length UnitConversions.inches_to_feetinches(length) end |
#imperial_width ⇒ Object
Renders width in plain inches if < 12 or converts to feet and inches notation
25 26 27 |
# File 'app/services/item/heating_element_line.rb', line 25 def imperial_width UnitConversions.inches_to_feetinches(width) end |
#merge_by_length(other_heating_element_line) ⇒ Object
39 40 41 42 43 44 |
# File 'app/services/item/heating_element_line.rb', line 39 def merge_by_length(other_heating_element_line) %i[length amps watts].each do |col| public_send(:"#{col}=", public_send(col) + other_heating_element_line.public_send(col)) end self end |
#volts_with_alternative_volts(alternative_volts_explanation) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/services/item/heating_element_line.rb', line 46 def volts_with_alternative_volts(alternative_volts_explanation) if alternative_volts.present? symbol = alternative_volts_explanation.select { |_sym, a_volts| a_volts == alternative_volts }.keys.first "#{volts}<sup>#{symbol}</sup>" else volts end end |