Class: Teek::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/teek/platform.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


13
# File 'lib/teek/platform.rb', line 13

def darwin?  = @platform.include?('darwin')

#linux?Boolean

Returns:

  • (Boolean)


14
# File 'lib/teek/platform.rb', line 14

def linux?   = @platform.include?('linux')

#to_sObject



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

Returns:

  • (Boolean)


15
# File 'lib/teek/platform.rb', line 15

def windows? = !!(@platform =~ /mingw|mswin|cygwin/)