Class: DataMapper::Property::Slug
- Inherits:
-
String
- Object
- String
- DataMapper::Property::Slug
- Defined in:
- lib/dm-types/slug.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) escape(string)
23 24 25 |
# File 'lib/dm-types/slug.rb', line 23 def escape(string) string.to_url end |
- (Object) typecast(value)
13 14 15 16 17 18 19 20 21 |
# File 'lib/dm-types/slug.rb', line 13 def typecast(value) if value.nil? nil elsif value.respond_to?(:to_str) escape(value.to_str) else raise ArgumentError, '+value+ must be nil or respond to #to_str' end end |