class Necromancer::NumericConverters::StringToIntegerConverter
An object that converts a String to an Integer
Public Instance Methods
call(value, options = {})
click to toggle source
Convert string value to integer
@example
converter.call('1abc') # => 1
@api public
# File lib/necromancer/converters/numeric.rb, line 20 def call(value, options = {}) strict = options.fetch(:strict, config.strict) Integer(value) rescue strict ? fail_conversion_type(value) : value.to_i end