Class: Teek::Platform
- Inherits:
-
Object
- Object
- Teek::Platform
- Defined in:
- lib/teek/platform.rb
Instance Method Summary collapse
- #darwin? ⇒ Boolean
-
#initialize(platform = RUBY_PLATFORM) ⇒ Platform
constructor
A new instance of Platform.
- #linux? ⇒ Boolean
- #to_s ⇒ Object
- #windows? ⇒ Boolean
Constructor Details
#initialize(platform = RUBY_PLATFORM) ⇒ Platform
Returns a new instance of Platform.
9 10 11 |
# File 'lib/teek/platform.rb', line 9 def initialize(platform = RUBY_PLATFORM) @platform = platform.freeze end |
Instance Method Details
#darwin? ⇒ Boolean
13 |
# File 'lib/teek/platform.rb', line 13 def darwin? = @platform.include?('darwin') |
#linux? ⇒ Boolean
14 |
# File 'lib/teek/platform.rb', line 14 def linux? = @platform.include?('linux') |
#to_s ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/teek/platform.rb', line 17 def to_s if darwin? then 'darwin' elsif windows? then 'windows' elsif linux? then 'linux' else @platform end end |
#windows? ⇒ Boolean
15 |
# File 'lib/teek/platform.rb', line 15 def windows? = !!(@platform =~ /mingw|mswin|cygwin/) |