Class: DataMapper::Types::Yaml
- Object
- DataMapper::Type
- DataMapper::Types::Yaml
Constants Inherited from DataMapper::Type
Public Visibility
Public Instance Methods Inherited from Object
Public Class Method Details
dump
public
dump(value, property)
[View source]
20 21 22 23 24 25 26 27 28 29 30 31 32
# File 'dm-more/dm-types/lib/dm-types/yaml.rb', line 20 def self.dump(value, property) if value.nil? nil elsif value.is_a?(String) && value =~ /^---/ value else ::YAML.dump(value) end end
load
public
load(value, property)
[View source]
10 11 12 13 14 15 16 17 18 19 20 21 22
# File 'dm-more/dm-types/lib/dm-types/yaml.rb', line 10 def self.load(value, property) if value.nil? nil elsif value.is_a?(String) ::YAML.load(value) else raise ArgumentError.new("+value+ must be nil or a String") end end