Class: Tumugi::Parameter::Converter
- Inherits:
-
Object
- Object
- Tumugi::Parameter::Converter
- Defined in:
- lib/tumugi/parameter/converter.rb
Constant Summary collapse
- CONVERTERS =
{ string: StringConverter.new, integer: IntegerConverter.new, float: FloatConverter.new, bool: BoolConverter.new, time: TimeConverter.new, }
Class Method Summary collapse
Class Method Details
.convert(type, value) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/tumugi/parameter/converter.rb', line 48 def self.convert(type, value) converter = CONVERTERS[type] if converter converter.convert(value) else raise ArgumentError.new("Invalid type: #{type}") end end |