Class: DataMapper::Property::FilePath
- Inherits:
-
String
- Object
- String
- DataMapper::Property::FilePath
- Defined in:
- lib/dm-types/file_path.rb
Instance Method Summary collapse
- #dump(value) ⇒ Object
- #load(value) ⇒ Object
- #primitive?(value) ⇒ Boolean
- #typecast_to_primitive(value) ⇒ Object
- #valid?(value, negated = false) ⇒ Boolean
Instance Method Details
#dump(value) ⇒ Object
22 23 24 |
# File 'lib/dm-types/file_path.rb', line 22 def dump(value) value.to_s unless DataMapper::Ext.blank?(value) end |
#load(value) ⇒ Object
18 19 20 |
# File 'lib/dm-types/file_path.rb', line 18 def load(value) Pathname.new(value) unless DataMapper::Ext.blank?(value) end |
#primitive?(value) ⇒ Boolean
10 11 12 |
# File 'lib/dm-types/file_path.rb', line 10 def primitive?(value) value.kind_of?(Pathname) end |
#typecast_to_primitive(value) ⇒ Object
26 27 28 |
# File 'lib/dm-types/file_path.rb', line 26 def typecast_to_primitive(value) load(value) end |
#valid?(value, negated = false) ⇒ Boolean
14 15 16 |
# File 'lib/dm-types/file_path.rb', line 14 def valid?(value, negated = false) super || dump(value).kind_of?(::String) end |