Module: LightIO::Module::Base

Included in:
Addrinfo, BasicSocket, File, IO, IPSocket, Socket, TCPServer, TCPSocket, Thread, ThreadsWait, UDPSocket, UNIXServer, UNIXSocket
Defined in:
lib/lightio/module/base.rb

Defined Under Namespace

Modules: Helper, NewHelper

Class Method Summary collapse

Class Method Details

.find_library_class(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/lightio/module/base.rb', line 4

def find_library_class(klass)
  return LightIO::Library::Base.send(:nameless_classes)[klass] if klass.name.nil?
  name = klass.name
  begin
    LightIO::Library.const_get(name)
  rescue NameError
    # retry without namespace
    namespace_index = name.rindex("::")
    raise if namespace_index.nil?
    class_name = name[(namespace_index + 2)..-1]
    LightIO::Library.const_get(class_name)
  end
end