Sha256: 532a7fa70a80d9d4072abcfdd2df01837797af4c85fd5ecdf04cef483c9ae4b2
Contents?: true
Size: 824 Bytes
Versions: 2
Compression:
Stored size: 824 Bytes
Contents
require 'yaml' module DataMapper module Types class Yaml < DataMapper::Type primitive String length 65535 lazy true def self.load(value, property) 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 self.dump(value, property) if value.nil? nil elsif value.is_a?(String) && value =~ /^---/ value else ::YAML.dump(value) end end def self.typecast(value, property) # No typecasting; leave values exactly as they're provided. value end end # class Yaml end # module Types end # module DataMapper
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-types-0.10.1 | lib/dm-types/yaml.rb |
dm-types-0.10.0 | lib/dm-types/yaml.rb |