Sha256: c6ee6de2e60ac726231f9c7b006d6c36a56c6c72db60b1b365cf3ba62fd8668d
Contents?: true
Size: 654 Bytes
Versions: 3
Compression:
Stored size: 654 Bytes
Contents
module DataMapper class Property class BinaryString < Text def custom? true end def primitive?(value) value.kind_of?(::String) end def valid?(value, negated = false) super || dump(value).kind_of?(::String) end def load(value) if value.nil? nil elsif value.is_a?(::String) value else raise ArgumentError.new("not sure what type #{value.class}") end end def dump(value) "<<\"#{value.to_s}\">>" end def typecast_to_primitive(value) value.to_s end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dm-mnesia-0.2.10 | lib/types/binary_string.rb |
dm-mnesia-0.2.9 | lib/types/binary_string.rb |
dm-mnesia-0.2.8 | lib/types/binary_string.rb |