Method: LinuxStat::Kernel.compiler
- Defined in:
- lib/linux_stat/kernel.rb
.compiler ⇒ Object
Returns the compiler used to compile the Linux Kernel.
If the information isn’t available, it will return a frozen empty string.
The output is also cached (memoized) ; as changing the value in runtime is unexpected.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/linux_stat/kernel.rb', line 35 def compiler return ''.freeze if string.empty? @@compiler ||= string.split(/(\(.+\))/).each(&:strip!) .reject(&:empty?) .find { |x| x[/^\(.+\)$/] }.to_s .split.find { |x| !x[/^(.+@.+)$/] }.to_s[/\w+/].to_s.freeze @@compiler_val ||= case @@compiler when /gcc/i then [:gcc ] when /clang/i then [:clang] when /icc/i then [:icc] else [@@compiler &.to_sym] end << compiler_version end |