class Quack::Types::Integer

Constants

PATTERN

Public Class Methods

built_in_types() click to toggle source
# File lib/quack/types/integer.rb, line 9
def built_in_types
  @@built_in_types ||=
    ObjectSpace.each_object(Integer.singleton_class).to_a
end
matches?(value) click to toggle source
# File lib/quack/types/integer.rb, line 14
def matches?(value)
  already_coerced?(value) || !!(value.to_s.strip =~ PATTERN)
end

Public Instance Methods

to_coerced() click to toggle source
# File lib/quack/types/integer.rb, line 19
def to_coerced
  already_coerced? ? value : value.to_i
end