Module: EasyType::Validators::Integer
- Defined in:
- lib/easy_type/validators.rb
Overview
This validator validates if it is an Integer
Instance Method Summary collapse
Instance Method Details
#unsafe_validate(value) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/easy_type/validators.rb', line 47 def unsafe_validate(value) klass = value.class.to_s case klass when'Fixnum', 'Bignum' return when 'String' fail Puppet::Error, "Invalid integer value: #{value}" unless value =~ STRING_OF_DIGITS else fail Puppet::Error, "Invalid integer value: #{value}" end end |