Class: Utils

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

Class Method Summary collapse

Class Method Details

.format_time(secs) ⇒ Object

def self.format_time(seconds)

seconds ||= 0
Time.at(seconds.round).utc.strftime('%H:%M:%S')#%Y %M %D

end



14
15
16
17
18
19
# File 'lib/utils.rb', line 14

def self.format_time(secs)
  # secs ||= 0
  # Time.at(secs.round).utc.strftime('%Hh %Mm')
  secs ||= 0
  '%02sh %02dm' % [secs / 3600, (secs / 60) % 60]
end

.is_integer?(str) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/utils.rb', line 21

def self.is_integer?(str)
  str.to_i.to_s == str
end