Class: DataMapper::Types::FilePath
- Inherits:
-
DataMapper::Type
- Object
- DataMapper::Type
- DataMapper::Types::FilePath
- Defined in:
- lib/dm-types/file_path.rb
Class Method Summary collapse
Class Method Details
.dump(value, property) ⇒ Object
17 18 19 20 |
# File 'lib/dm-types/file_path.rb', line 17 def self.dump(value, property) return nil if value.blank? value.to_s end |
.load(value, property) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/dm-types/file_path.rb', line 9 def self.load(value, property) if value.blank? nil else Pathname.new(value) end end |
.typecast(value, property) ⇒ Object
22 23 24 25 |
# File 'lib/dm-types/file_path.rb', line 22 def self.typecast(value, property) # Leave alone if a Pathname is given. value.kind_of?(Pathname) ? value : load(value, property) end |