lib/virtus/attribute/string.rb in virtus-0.0.5 vs lib/virtus/attribute/string.rb in virtus-0.0.6
- old
+ new
@@ -1,10 +1,11 @@
module Virtus
class Attribute
- # Example usage
+ # String
#
+ # @example
# class User
# include Virtus
#
# attribute :name, String
# end
@@ -13,19 +14,11 @@
#
# # typecasting from an object which implements #to_s
# User.new(:name => :John)
#
class String < Object
- primitive ::String
-
- # @see Virtus::Typecast::String.call
- #
- # @return [String]
- #
- # @api private
- def typecast_to_primitive(value)
- Virtus::Typecast::String.call(value)
- end
+ primitive ::String
+ coercion_method :to_string
end # class String
end # class Attribute
end # module Virtus