Sha256: 1e5aa20b1b3c4c881666b6180e66ff165491553ba6dd4e89e46b83719d01976f
Contents?: true
Size: 700 Bytes
Versions: 8
Compression:
Stored size: 700 Bytes
Contents
require 'yaml' require 'dm-core' module DataMapper class Property class Yaml < Text def custom? true end def load(value) if value.nil? nil elsif value.is_a?(::String) ::YAML.load(value) else raise ArgumentError.new("+value+ of a property of YAML type must be nil or a String") end end def dump(value) if value.nil? nil elsif value.is_a?(::String) && value =~ /^---/ value else ::YAML.dump(value) end end def typecast(value) value end end # class Yaml end # class Property end # module DataMapper
Version data entries
8 entries across 8 versions & 1 rubygems