Module: Konjac::Office::OS
- Defined in:
- lib/konjac/office/os.rb
Overview
A module for determining what OS we’re using
Class Method Summary collapse
-
.linux? ⇒ Boolean
OS is a version of Linux.
-
.mac? ⇒ Boolean
OS is a version of Mac.
-
.not_a_mac ⇒ Object
Throws a message if the computer is using a command restricted to Macs.
-
.posix? ⇒ Boolean
OS is POSIX (well, actually, this makes the somewhat bad assumption that non-Windows OSes are POSIX).
-
.to_s ⇒ Object
Override string output.
-
.windows? ⇒ Boolean
OS is a version of Windows.
Class Method Details
.linux? ⇒ Boolean
OS is a version of Linux
17 18 19 |
# File 'lib/konjac/office/os.rb', line 17 def linux? @linux ||= is? /linux|cygwin/ end |
.mac? ⇒ Boolean
OS is a version of Mac
12 13 14 |
# File 'lib/konjac/office/os.rb', line 12 def mac? @mac ||= is? /mac|darwin/ end |
.not_a_mac ⇒ Object
Throws a message if the computer is using a command restricted to Macs
33 34 35 36 37 38 39 40 |
# File 'lib/konjac/office/os.rb', line 33 def not_a_mac if mac? return false else puts I18n.t(:mac_only) return true end end |
.posix? ⇒ Boolean
OS is POSIX (well, actually, this makes the somewhat bad assumption that non-Windows OSes are POSIX)
28 29 30 |
# File 'lib/konjac/office/os.rb', line 28 def posix? !windows? end |
.to_s ⇒ Object
Override string output
7 8 9 |
# File 'lib/konjac/office/os.rb', line 7 def to_s RbConfig::CONFIG["host_os"] end |
.windows? ⇒ Boolean
OS is a version of Windows
22 23 24 |
# File 'lib/konjac/office/os.rb', line 22 def windows? @windows ||= is? /mswin|^win|mingw/ end |