Module: Einhorn::Event::Persistent

Included in:
ACKTimer, CommandServer, Connection
Defined in:
lib/einhorn/event/persistent.rb

Constant Summary collapse

@@persistent =
{}

Class Method Summary collapse

Class Method Details

.from_state(state) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/einhorn/event/persistent.rb', line 9

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.", :upgrade)
    nil
  end
end

.included(other) ⇒ Object



5
6
7
# File 'lib/einhorn/event/persistent.rb', line 5

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

.persistent?(descriptor) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/einhorn/event/persistent.rb', line 19

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