Class: OpenGLLib::Linux

Inherits:
Object
  • Object
show all
Defined in:
lib/mittsu/renderers/opengl/opengl_lib.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loader = Linux) ⇒ Linux

Returns a new instance of Linux.



16
17
18
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 16

def initialize(loader = Linux)
  @loader = loader
end

Class Method Details

.kernel_module_in_useObject



31
32
33
34
35
36
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 31

def kernel_module_in_use
  lspci_line = `lspci -nnk | grep -i vga -A3 | grep 'in use'`
  /in use:\s*(\S+)/ =~ lspci_line && $1
rescue
  ''
end

.ldconfigObject



48
49
50
51
52
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 48

def ldconfig
  `ldconfig -p | grep 'libGL\\.so'`.lines
rescue
  []
end

.libgl_pathsObject



38
39
40
41
42
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 38

def libgl_paths
  Dir.glob('/usr/lib*/**/libGL.so*')
rescue
  []
end

.sixtyfour_bits?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 44

def sixtyfour_bits?
  1.size == 8
end

Instance Method Details

#fileObject



25
26
27
28
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 25

def file
  return nil if file_path.nil?
  File.basename file_path
end

#pathObject



20
21
22
23
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 20

def path
  return nil if file_path.nil?
  File.dirname file_path
end