class Necromancer::NumericConverters::StringToIntegerConverter

An object that converts a String to an Integer

Public Instance Methods

call(value, strict: config.strict) click to toggle source

Convert string value to integer

@example

converter.call("1abc")  # => 1

@api public

# File lib/necromancer/converters/numeric.rb, line 21
def call(value, strict: config.strict)
  Integer(value)
rescue StandardError
  strict ? raise_conversion_type(value) : value.to_i
end