Class: Notifaction::Utils
- Inherits:
-
Object
- Object
- Notifaction::Utils
- Defined in:
- lib/notifaction/utils.rb
Class Method Summary collapse
-
.formatted_time(time = nil) ⇒ Object
Returns a formatted time string Used, mainly, for printing timestamps next to terminal output.
-
.os ⇒ Object
Determine the current OS.
Class Method Details
.formatted_time(time = nil) ⇒ Object
Returns a formatted time string Used, mainly, for printing timestamps next to terminal output
6 7 8 9 10 11 12 |
# File 'lib/notifaction/utils.rb', line 6 def self.formatted_time(time = nil) if time.nil? time = Time.now end time.strftime("%e/%-m/%Y @ %I:%M:%S%P") end |
.os ⇒ Object
Determine the current OS
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/notifaction/utils.rb', line 16 def self.os host_os = RbConfig::CONFIG['host_os'] case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :macosx when /linux/ :linux when /solaris|bsd/ :unix else puts "unknown os: #{host_os.inspect}" end end |