Module: Necromancer::RangeConverters

Defined in:
lib/necromancer/converters/range.rb

Overview

Container for Range converter classes

Defined Under Namespace

Classes: StringToRangeConverter

Constant Summary collapse

SINGLE_DIGIT_MATCHER =
/^(?<digit>-?\d+(\.\d+)?)$/.freeze
DIGIT_MATCHER =
/^(?<open>-?\d+(\.\d+)?)
  \s*(?<sep>(\.\s*){2,3}|-|,)\s*
  (?<close>-?\d+(\.\d+)?)$
/x.freeze
LETTER_MATCHER =
/^(?<open>\w)
\s*(?<sep>(\.\s*){2,3}|-|,)\s*
(?<close>\w)$
/x.freeze

Class Method Summary collapse

Class Method Details

.load(conversions) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/necromancer/converters/range.rb', line 62

def self.load(conversions)
  [
    StringToRangeConverter.new(:string, :range),
    NullConverter.new(:range, :range)
  ].each do |converter|
    conversions.register converter
  end
end