Module: Necromancer::NumericConverters
- Defined in:
- lib/necromancer/converters/numeric.rb
Overview
Container for Numeric converter classes
Defined Under Namespace
Classes: IntegerToStringConverter, StringToFloatConverter, StringToIntegerConverter, StringToNumericConverter
Constant Summary collapse
- INTEGER_MATCHER =
/^\s*[-+]?\s*(\d[\d\s]*)?$/.freeze
- FLOAT_MATCHER =
/^\s*[-+]?([\d\s]*)(\.[\d\s]+)?([eE]?[-+]?[\d\s]+)?$/.freeze
Class Method Summary collapse
Class Method Details
.load(conversions) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/necromancer/converters/numeric.rb', line 79 def self.load(conversions) [ StringToIntegerConverter.new(:string, :integer), IntegerToStringConverter.new(:integer, :string), NullConverter.new(:integer, :integer), StringToFloatConverter.new(:string, :float), NullConverter.new(:float, :float), StringToNumericConverter.new(:string, :numeric) ].each do |converter| conversions.register converter end end |