Class: DataMapper::Property::Yaml
- Inherits:
-
Text
- Object
- Text
- DataMapper::Property::Yaml
- Includes:
- DirtyMinder
- Defined in:
- lib/dm-types/yaml.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods included from DirtyMinder
Instance Method Details
#custom? ⇒ Boolean
9 10 11 |
# File 'lib/dm-types/yaml.rb', line 9 def custom? true end |
#dump(value) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/dm-types/yaml.rb', line 23 def dump(value) if value.nil? nil elsif value.is_a?(::String) && value =~ /^---/ value else ::YAML.dump(value) end end |
#load(value) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/dm-types/yaml.rb', line 13 def load(value) if value.nil? nil elsif value.is_a?(::String) ::YAML.load(value) else raise ArgumentError, '+value+ of a property of YAML type must be nil or a String' end end |
#typecast(value) ⇒ Object
33 34 35 |
# File 'lib/dm-types/yaml.rb', line 33 def typecast(value) value end |