class Dynflow::Flows::Registry

Public Class Methods

decode(identifier) click to toggle source
# File lib/dynflow/flows/registry.rb, line 22
def decode(identifier)
  serialization_map[identifier] || raise(UnknownIdentifier, "Could not find mapping for #{identifier}")
end
encode(klass) click to toggle source
# File lib/dynflow/flows/registry.rb, line 17
def encode(klass)
  klass = klass.class unless klass.is_a?(Class)
  serialization_map.invert[klass] || raise(UnknownIdentifier, "Could not find mapping for #{klass}")
end
register!(klass, identifier) click to toggle source
# File lib/dynflow/flows/registry.rb, line 9
def register!(klass, identifier)
  if (found = serialization_map[identifier])
    raise IdentifierTaken, "Error setting up mapping #{identifier} to #{klass}, it already maps to #{found}"
  else
    serialization_map.update(identifier => klass)
  end
end
serialization_map() click to toggle source
# File lib/dynflow/flows/registry.rb, line 26
def serialization_map
  @serialization_map ||= {}
end