Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/lizarb/ruby/time.rb

Instance Method Summary collapse

Instance Method Details

#diff(digits = 4) ⇒ Object



4
5
6
7
8
# File 'lib/lizarb/ruby/time.rb', line 4

def diff digits = 4
  f = (self.class.now.to_f - to_f).floor(digits)
  u, d = f.to_s.split "."
  "#{u}.#{d.ljust digits, "0"}"
end