class Attrio::Types::Integer

Public Class Methods

typecast(value, options = {}) click to toggle source
# File lib/attrio/types/integer.rb, line 6
def self.typecast(value, options = {})
  options[:base] ||= 10

  begin
    return value.to_i(options[:base]) if value.is_a?(String)
    return value.to_i
  rescue NoMethodError => e
    nil
  end
end
typecasted?(value, options = {}) click to toggle source
# File lib/attrio/types/integer.rb, line 17
def self.typecasted?(value, options = {})
  value.is_a? ::Integer
end