# File lib/coercible/coercer/string.rb, line 156 def to_integer(value) if value =~ /\A#{INTEGER_REGEXP}\z/ value.to_i else # coerce to a Float first to evaluate scientific notation (if any) # that may change the integer part, then convert to an integer to_float(value).to_i end rescue UnsupportedCoercion raise_unsupported_coercion(value, __method__) end