Class: Burn::Util::Os

Inherits:
Object
  • Object
show all
Defined in:
lib/burn/util/os.rb

Instance Method Summary collapse

Constructor Details

#initializeOs

Returns a new instance of Os.



7
8
9
# File 'lib/burn/util/os.rb', line 7

def initialize
  @name = RbConfig::CONFIG['host_os']
end

Instance Method Details

#is_linux?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/burn/util/os.rb', line 21

def is_linux?
  return true if @name =~ /linux|cygwin|bsd|solaris|sunos/
  false
end

#is_mac?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/burn/util/os.rb', line 16

def is_mac?
  return true if @name =~ /mac|darwin/
  false
end

#is_win?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/burn/util/os.rb', line 11

def is_win?
  return true if @name =~ /mswin(?!ce)|mingw|bccwin/
  false
end

#nameObject



26
27
28
29
30
31
32
33
34
# File 'lib/burn/util/os.rb', line 26

def name
  if is_win? then
    "win"
  elsif is_mac? then
    "mac"
  else
    "other"
  end
end