Sha256: 7e2b39ec6e3a3897f5ce46002f4154943ee152f1911cb5b4e1ff6901dff205f2

Contents?: true

Size: 682 Bytes

Versions: 13

Compression:

Stored size: 682 Bytes

Contents

module Einhorn::Event
  module Persistent
    @@persistent = {}

    def self.included(other)
      @@persistent[other.to_s] = other
    end

    def self.from_state(state)
      klass_name = state[:class]
      if klass = @@persistent[klass_name]
        klass.from_state(state)
      else
        Einhorn.log_error("Unrecognized persistent descriptor class #{klass_name.inspect}. Ignoring. This most likely indicates that your Einhorn version has upgraded. Everything should still be working, but it may be worth a restart.")
        nil
      end
    end

    def self.persistent?(descriptor)
      @@persistent.values.any? {|klass| descriptor.kind_of?(klass)}
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
einhorn-0.4.9 lib/einhorn/event/persistent.rb
einhorn-0.4.8 lib/einhorn/event/persistent.rb
einhorn-0.4.7 lib/einhorn/event/persistent.rb
einhorn-0.4.6 lib/einhorn/event/persistent.rb
einhorn-0.4.5 lib/einhorn/event/persistent.rb
einhorn-0.4.4 lib/einhorn/event/persistent.rb
einhorn-0.4.3 lib/einhorn/event/persistent.rb
einhorn-0.4.2 lib/einhorn/event/persistent.rb
einhorn-0.4.1 lib/einhorn/event/persistent.rb
einhorn-0.4.0 lib/einhorn/event/persistent.rb
einhorn-0.3.2 lib/einhorn/event/persistent.rb
einhorn-0.3.1 lib/einhorn/event/persistent.rb
einhorn-0.3.0 lib/einhorn/event/persistent.rb