module InoxConverter
Constants
- VERSION
Public Class Methods
addAreaUnit(newUnit, newRate)
click to toggle source
# File lib/inox_converter.rb, line 88 def self.addAreaUnit(newUnit, newRate) self.newAreaInstance @areaConverter.addUnit(newUnit, newRate) end
addDateFormat(newFormat, newRate)
click to toggle source
# File lib/inox_converter.rb, line 103 def self.addDateFormat(newFormat, newRate) self.newDateFormatInstance @dateFormater.addUnit(newFormat, newRate) end
addLenghtUnit(newUnit, newRate)
click to toggle source
Add unit methods newUnit: name of the new unit to be added newRate: reason between new unit and base unit
# File lib/inox_converter.rb, line 78 def self.addLenghtUnit(newUnit, newRate) self.newLenghtInstance @lengthConverter.addUnit(newUnit, newRate) end
addMassUnit(newUnit, newRate)
click to toggle source
# File lib/inox_converter.rb, line 93 def self.addMassUnit(newUnit, newRate) self.newMassInstance @massConverter.addUnit(newUnit, newRate) end
addTimeFormat(newFormat, newRate)
click to toggle source
# File lib/inox_converter.rb, line 108 def self.addTimeFormat(newFormat, newRate) self.newTimeFormatInstance @timeFormater.addUnit(newFormat, newRate) end
addTimeUnit(newUnit, newRate)
click to toggle source
# File lib/inox_converter.rb, line 98 def self.addTimeUnit(newUnit, newRate) self.newTimeInstance @timeConverter.addUnit(newUnit, newRate) end
addVolumeUnit(newUnit, newRate)
click to toggle source
# File lib/inox_converter.rb, line 83 def self.addVolumeUnit(newUnit, newRate) self.newVolumeInstance @volumeConverter.addUnit(newUnit, newRate) end
convertArea(valueToConvert, firstUnit, secondUnit)
click to toggle source
# File lib/inox_converter.rb, line 55 def self.convertArea(valueToConvert, firstUnit, secondUnit) puts "Area convertion" self.newAreaInstance @areaConverter.convert(valueToConvert, firstUnit, secondUnit) end
convertCurrency(valueToConvert, firstUnit, secondUnit)
click to toggle source
firstUnit = actual unit secondUnit = final unit returns the value converted
# File lib/inox_converter.rb, line 37 def self.convertCurrency(valueToConvert, firstUnit, secondUnit) puts "Currency conversion" currencyConverter = InoxConverter::CurrencyAdapter.new() currencyConverter.convert(valueToConvert, firstUnit, secondUnit) end
convertDateFormat(dateToConvert, desiredFormat)
click to toggle source
# File lib/inox_converter.rb, line 22 def self.convertDateFormat(dateToConvert, desiredFormat) puts "Date Formater" self.newDateFormatInstance @dateFormater.formatDate(dateToConvert, desiredFormat) end
convertLenght(valueToConvert, firstUnit, secondUnit)
click to toggle source
# File lib/inox_converter.rb, line 43 def self.convertLenght(valueToConvert, firstUnit, secondUnit) puts "Lenght convertion" self.newLenghtInstance @lengthConverter.convert(valueToConvert, firstUnit, secondUnit) end
convertMass(valueToConvert, firstUnit, secondUnit)
click to toggle source
# File lib/inox_converter.rb, line 61 def self.convertMass(valueToConvert, firstUnit, secondUnit) puts "Mass convertion" self.newMassInstance @massConverter.convert(valueToConvert, firstUnit, secondUnit) end
convertTime(valueToConvert, firstUnit, secondUnit)
click to toggle source
# File lib/inox_converter.rb, line 67 def self.convertTime(valueToConvert, firstUnit, secondUnit) puts "Time convertion" self.newTimeInstance @timeConverter.convert(valueToConvert, firstUnit, secondUnit) end
convertTimeFormat(timeToConvert, desiredFormat)
click to toggle source
# File lib/inox_converter.rb, line 28 def self.convertTimeFormat(timeToConvert, desiredFormat) puts "Time Formater" self.newTimeFormatInstance @timeFormater.formatTime(timeToConvert, desiredFormat) end
convertVolume(valueToConvert, firstUnit, secondUnit)
click to toggle source
# File lib/inox_converter.rb, line 49 def self.convertVolume(valueToConvert, firstUnit, secondUnit) puts "Volume convertion" self.newVolumeInstance @volumeConverter.convert(valueToConvert, firstUnit, secondUnit) end
hi()
click to toggle source
Facade Conversion methods
# File lib/inox_converter.rb, line 18 def self.hi puts "Hi, you are using InoxConverter!" end
newAreaInstance()
click to toggle source
# File lib/inox_converter.rb, line 147 def self.newAreaInstance() if @areaConverter.nil? @areaConverter = Area.new() else # do nothing end end
newDateFormatInstance()
click to toggle source
# File lib/inox_converter.rb, line 123 def self.newDateFormatInstance() if @dateFormater.nil? @dateFormater = DateFormat.new() else # do nothing end end
newLenghtInstance()
click to toggle source
Instantiation methods
# File lib/inox_converter.rb, line 115 def self.newLenghtInstance() if @lengthConverter.nil? @lengthConverter = Length.new() else # do nothing end end
newMassInstance()
click to toggle source
# File lib/inox_converter.rb, line 155 def self.newMassInstance() if @massConverter.nil? @massConverter = Mass.new() else # do nothing end end
newTimeFormatInstance()
click to toggle source
# File lib/inox_converter.rb, line 131 def self.newTimeFormatInstance() if @timeFormater.nil? @timeFormater = TimeFormat.new() else # do nothing end end
newTimeInstance()
click to toggle source
# File lib/inox_converter.rb, line 163 def self.newTimeInstance() if @timeConverter.nil? @timeConverter = Time.new() else # do nothing end end
newVolumeInstance()
click to toggle source
# File lib/inox_converter.rb, line 139 def self.newVolumeInstance() if @volumeConverter.nil? @volumeConverter = Volume.new() else # do nothing end end