Sha256: db247b517253bd8844f4a5cf58a5d0eb19805021690fd99c308d54b05a77a400

Contents?: true

Size: 609 Bytes

Versions: 8

Compression:

Stored size: 609 Bytes

Contents

require 'yaml'

module Spider; module DataTypes
    
    class SerializedObject
        include DataType
        maps_to Text
        
        def self.from_value(val)
            if (val.is_a?(String))
                val = YAML::load(val)
            end
            val.extend(SerializedMixin)
        end
        
    end
    
    module SerializedMixin
        include DataType
        
        def map(mapper_type)
            YAML::dump(self)
        end
        
        def map_back(mapper_type, val)
            YAML::load(val).extend(SerializedMixin)
        end
        
    end
    
    
end; end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spiderfw-0.5.7 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5.6 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5.5 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5.4 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5.3 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5.2 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5.1 lib/spiderfw/model/datatypes/serialized_object.rb
spiderfw-0.5 lib/spiderfw/model/datatypes/serialized_object.rb