Class: Quack::Types::Integer
- Inherits:
-
Quack::Type
- Object
- Quack::Type
- Quack::Types::Integer
- Defined in:
- lib/quack/types/integer.rb
Constant Summary collapse
- PATTERN =
/\A-?\d+\z/
Instance Attribute Summary
Attributes inherited from Quack::Type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Quack::Type
#already_coerced?, already_coerced?, #initialize, #to_s, #type_matches?
Constructor Details
This class inherits a constructor from Quack::Type
Class Method Details
.built_in_types ⇒ Object
9 10 11 12 |
# File 'lib/quack/types/integer.rb', line 9 def built_in_types @@built_in_types ||= ObjectSpace.each_object(Integer.singleton_class).to_a end |
Instance Method Details
#to_coerced ⇒ Object
19 20 21 |
# File 'lib/quack/types/integer.rb', line 19 def to_coerced already_coerced? ? value : value.to_i end |