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

Defined in:
lib/submodules/ably-ruby/lib/ably/modules/uses_state_machine.rb

Instance Method Summary collapse

Instance Method Details

#emits_klassObject



93
94
95
96
97
# File 'lib/submodules/ably-ruby/lib/ably/modules/uses_state_machine.rb', line 93

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



99
100
101
# File 'lib/submodules/ably-ruby/lib/ably/modules/uses_state_machine.rb', line 99

def ensure_state_machine_emits(klass)
  @emits_klass_name = klass
end

#get_const(klass_name) ⇒ Object



103
104
105
106
107
108
# File 'lib/submodules/ably-ruby/lib/ably/modules/uses_state_machine.rb', line 103

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