Class: ET::OperatingSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/et/operating_system.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(os = nil, version = nil) ⇒ OperatingSystem

Returns a new instance of OperatingSystem.



7
8
9
10
11
12
# File 'lib/et/operating_system.rb', line 7

def initialize(os = nil, version = nil)
  @raw_name, @version = os, version
  if @raw_name.nil?
    derive_raw_name
  end
end

Instance Attribute Details

#raw_nameObject (readonly)

Returns the value of attribute raw_name.



5
6
7
# File 'lib/et/operating_system.rb', line 5

def raw_name
  @raw_name
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/et/operating_system.rb', line 5

def version
  @version
end

Instance Method Details

#nameObject

cribbed from Selenium



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/et/operating_system.rb', line 15

def name
  case @raw_name
  when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
    :windows
  when /darwin|mac os/
    :mac
  when /linux/
    :linux
  when /solaris|bsd/
    :unix
  end
end

#platform_family?(platform) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/et/operating_system.rb', line 28

def platform_family?(platform)
  name == platform.to_sym
end