lib/ultra_config/validator.rb in ultra_config-0.2.0 vs lib/ultra_config/validator.rb in ultra_config-0.3.0
- old
+ new
@@ -1,7 +1,11 @@
+require_relative 'utilities/boolean'
+
module UltraConfig
class Validator
+ extend Boolean
+
class ValidationError < StandardError; end
class TypeValidationError < ValidationError; end
def self.validate(old, new, &validation)
@test_value = new
@@ -12,9 +16,10 @@
@test_value = nil
end
def self.type_safety(old)
return if old.nil?
+ return if old.is_a?(Boolean) && @test_value.is_a?(Boolean)
raise TypeValidationError if old.class != @test_value.class
end
def self.one_of(list)
\ No newline at end of file