lib/virtus/attribute/integer.rb in virtus-0.0.5 vs lib/virtus/attribute/integer.rb in virtus-0.0.6
- old
+ new
@@ -1,10 +1,11 @@
module Virtus
class Attribute
- # Example usage:
+ # Integer
#
+ # @example
# class Post
# include Virtus
#
# attribute :read_count, Integer
# end
@@ -16,19 +17,11 @@
#
# # typecasting from an object that implements #to_i
# Post.new(:read_count => 100.0)
#
class Integer < Numeric
- primitive ::Integer
-
- # @see Virtus::Typecast::Numeric.to_i
- #
- # @return [Integer]
- #
- # @api private
- def typecast_to_primitive(value)
- Typecast::Numeric.to_i(value)
- end
+ primitive ::Integer
+ coercion_method :to_integer
end # class Integer
end # class Attribute
end # module Virtus