lib/inox_converter/converter.rb
def convert(valueToConvert, firstUnit, secondUnit)
			# First Step
			finalValue = valueToConvert.round(10)

			# Second Step
			firstUnitResultant = getInDictionary(firstUnit)
			if firstUnitResultant.nil? 
				raise NotImplementedError.new("#{firstUnit} isn't recognized by InoxConverter") 
			end
			finalValue *= firstUnitResultant.round(10)

			# Third step
			secondUnitResultant = getInDictionary(secondUnit)
			if secondUnitResultant.nil? 
				raise NotImplementedError.new("#{secondUnit} isn't recognized by InoxConverter") 
			end
			finalValue /= secondUnitResultant.round(10)

			# Fourth step
			return finalValue.round(10)
		end
def convert(valueToConvert, firstUnit, secondUnit)
			# First Step
			finalValue = valueToConvert.round(10)

			# Second Step
			firstUnitResultant = getInDictionary(firstUnit)
			if firstUnitResultant.nil? 
				raise NotImplementedError.new("#{firstUnit} isn't recognized by InoxConverter") 
			end
			finalValue *= firstUnitResultant.round(10)

			# Third step
			secondUnitResultant = getInDictionary(secondUnit)
			if secondUnitResultant.nil? 
				raise NotImplementedError.new("#{secondUnit} isn't recognized by InoxConverter") 
			end
			finalValue /= secondUnitResultant.round(10)

			# Fourth step
			return finalValue.round(10)
		end
def convert ( valueToConvert , firstUnit , secondUnit ) # First Step finalValue = valueToConvert . round ( 10 ) # Second Step firstUnitResultant = getInDictionary ( firstUnit ) if firstUnitResultant . nil? raise NotImplementedError . new ( "#{firstUnit} isn't recognized by InoxConverter" ) end finalValue *= firstUnitResultant . round ( 10 ) # Third step secondUnitResultant = getInDictionary ( secondUnit ) if secondUnitResultant . nil? raise NotImplementedError . new ( "#{secondUnit} isn't recognized by InoxConverter" ) end finalValue /= secondUnitResultant . round ( 10 ) # Fourth step return finalValue . round ( 10 ) end
Template to convert
Template to convert