class Freshen::System
The system class responsible for checking if the current system's kernel is supported.
Attributes
supported_kernels[R]
An array of supported kernels
Public Class Methods
check_supported!()
click to toggle source
Check if the current Operating System
is supported and if not, raise an UnsupportedOperatingSystem error
Example:
>> Freshen::System.check_supported! => nil
# File lib/freshen/system.rb, line 78 def self.check_supported! system = Freshen::System.new system.check_supported! end
new()
click to toggle source
Setup an instance of this class with an array of supported kernels
Example:
>> Freshen::System.new => #<Freshen:0x00000000000000>
# File lib/freshen/system.rb, line 21 def initialize @supported_kernels = [:darwin, :linux] end
Public Instance Methods
check_supported!()
click to toggle source
Check if the current kernel is supported and if not, raise an UnsupportedKernel
error
Example:
>> system = Freshen::System.new >> system.check_supported! => nil
# File lib/freshen/system.rb, line 65 def check_supported! unless supported? raise UnsupportedKernel.new(current) end end
kernel()
click to toggle source
Get the current version of this system's kernel
Example (OS X):
>> system = Freshen::System.new >> system.kernel => darwin
Example (Linux):
>> system = Freshen::System.new >> system.kernel => linux
# File lib/freshen/system.rb, line 37 def kernel Gem::Platform.local.os end
supported?()
click to toggle source
A boolean value of whether or not this system's kernel is supported
Example:
>> system = Freshen::System.new >> system.supported? => true
# File lib/freshen/system.rb, line 49 def supported? @supported_kernels.each do |k| return true if k.to_s == kernel end return false end