Sha256: 85e48483e3a8e11fde730b0582ab4bb0b7ffa9c3128f7fbd884ae2de08d0d25b

Contents?: true

Size: 629 Bytes

Versions: 14

Compression:

Stored size: 629 Bytes

Contents

require 'yaml'
if YAML.parser.class.name =~ /syck|yecht/i
  module StateManager
    class Base
      yaml_as "tag:grouptalent.com,2012:StateManager"

      def self.yaml_new(klass, tag, val)
        klass.new(val['resource'], val['context'])
      end

      def to_yaml_properties
        ['@resource', '@context']
      end
    end
  end
else
  module StateManager
    class Base
      def encode_with(coder)
        coder.map = {
          "resource" => resource,
          "context" => context
        }
      end

      def init_with(coder)
        initialize(coder["resource"], coder["context"])
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
state_manager-0.4.0 lib/state_manager/serialization.rb
state_manager-0.3.5 lib/state_manager/serialization.rb
state_manager-0.3.4 lib/state_manager/serialization.rb
state_manager-0.3.3 lib/state_manager/serialization.rb
state_manager-0.3.2 lib/state_manager/serialization.rb
state_manager-0.3.1 lib/state_manager/serialization.rb
state_manager-0.3.0 lib/state_manager/serialization.rb
state_manager-0.2.13 lib/state_manager/serialization.rb
state_manager-0.2.12 lib/state_manager/serialization.rb
state_manager-0.2.11 lib/state_manager/serialization.rb
state_manager-0.2.10 lib/state_manager/serialization.rb
state_manager-0.2.9 lib/state_manager/serialization.rb
state_manager-0.2.8 lib/state_manager/serialization.rb
state_manager-0.2.7 lib/state_manager/serialization.rb