class Resistor::CombinedResistor
Attributes
ohm[R]
Public Class Methods
new(ohm)
click to toggle source
Initializes a new CombinedResistor
object.
@see BasicResistor#+
@see BasicResistor#/ @param ohm [Float] resistance value @return [Resistor::CombinedResistor]
# File lib/resistor/combined_resistor.rb, line 12 def initialize(ohm) @ohm = ohm.to_f end
Public Instance Methods
+(other)
click to toggle source
Calculates a series combined resistance value.
@param other [Resistor::BasicResistor, Resistor::CombinedResistor
] @return [Resistor::CombinedResistor]
# File lib/resistor/combined_resistor.rb, line 20 def +(other) Resistor::CombinedResistor.new(@ohm + other.ohm) end
Also aliased as: -
/(other)
click to toggle source
Calculates a parallel combined resistance value.
@param other [Resistor::BasicResistor, Resistor::CombinedResistor
] @return [Resistor::CombinedResistor]
# File lib/resistor/combined_resistor.rb, line 29 def /(other) Resistor::CombinedResistor.new(1 / (1 / @ohm + 1 / other.ohm)) end
Also aliased as: |