Class: RocketFuel::OperatingSystem
- Inherits:
-
Object
- Object
- RocketFuel::OperatingSystem
- Defined in:
- lib/rocket_fuel/operating_system.rb
Instance Attribute Summary collapse
-
#raw_name ⇒ Object
readonly
Returns the value of attribute raw_name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(os = nil, version = nil) ⇒ OperatingSystem
constructor
A new instance of OperatingSystem.
-
#minor_version ⇒ Object
strip the patch level.
-
#name ⇒ Object
cribbed from Selenium.
- #platform_family?(platform) ⇒ Boolean
Constructor Details
#initialize(os = nil, version = nil) ⇒ OperatingSystem
Returns a new instance of OperatingSystem.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rocket_fuel/operating_system.rb', line 7 def initialize(os = nil, version = nil) @raw_name, @version = os, version if @raw_name.nil? derive_raw_name end if @version.nil? derive_version end end |
Instance Attribute Details
#raw_name ⇒ Object (readonly)
Returns the value of attribute raw_name.
5 6 7 |
# File 'lib/rocket_fuel/operating_system.rb', line 5 def raw_name @raw_name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/rocket_fuel/operating_system.rb', line 5 def version @version end |
Instance Method Details
#minor_version ⇒ Object
strip the patch level
38 39 40 |
# File 'lib/rocket_fuel/operating_system.rb', line 38 def minor_version /\A(\d+\.\d+)/.match(@version)[0] end |
#name ⇒ Object
cribbed from Selenium
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rocket_fuel/operating_system.rb', line 20 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
33 34 35 |
# File 'lib/rocket_fuel/operating_system.rb', line 33 def platform_family?(platform) name == platform.to_sym end |