Module: Ably::Modules::UsesStateMachine::ClassMethods

Defined in:
lib/ably/modules/uses_state_machine.rb

Instance Method Summary collapse

Instance Method Details

#emits_klassObject



89
90
91
92
93
# File 'lib/ably/modules/uses_state_machine.rb', line 89

def emits_klass
  @emits_klass ||= if defined?(@emits_klass_name) && @emits_klass_name
    get_const(@emits_klass_name)
  end
end

#ensure_state_machine_emits(klass) ⇒ Object



95
96
97
# File 'lib/ably/modules/uses_state_machine.rb', line 95

def ensure_state_machine_emits(klass)
  @emits_klass_name = klass
end

#get_const(klass_name) ⇒ Object



99
100
101
102
103
104
# File 'lib/ably/modules/uses_state_machine.rb', line 99

def get_const(klass_name)
  klass_names = klass_name.split('::')
  klass_names.inject(Kernel) do |klass, name|
    klass.const_get(name)
  end
end