Module: Necromancer::BooleanConverters

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

Overview

Container for Boolean converter classes

Defined Under Namespace

Classes: BooleanToIntegerConverter, IntegerToBooleanConverter, StringToBooleanConverter

Constant Summary collapse

TRUE_MATCHER =
/^(yes|y|on|t(rue)?|1)$/i.freeze
FALSE_MATCHER =
/^(no|n|off|f(alse)?|0)$/i.freeze

Class Method Summary collapse

Class Method Details

.load(conversions) ⇒ Object



79
80
81
82
83
84
85
86
87
88
# File 'lib/necromancer/converters/boolean.rb', line 79

def self.load(conversions)
  [
    StringToBooleanConverter.new(:string, :boolean),
    IntegerToBooleanConverter.new(:integer, :boolean),
    BooleanToIntegerConverter.new(:boolean, :integer),
    NullConverter.new(:boolean, :boolean)
  ].each do |converter|
    conversions.register converter
  end
end