Class: InferModel::Parsers::Integer
- Inherits:
-
Object
- Object
- InferModel::Parsers::Integer
- Extended by:
- Dry::Initializer, Callable
- Defined in:
- lib/infer_model/parsers/integer.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/infer_model/parsers/integer.rb', line 12 def call raise Parsers::Error, "value was blank which is not allowed" if value.nil? && !allow_blank return if value.nil? || value.empty? Integer(value, base) rescue ArgumentError raise Parsers::Error, "'#{value}' is not an Integer" end |