Sha256: 187e92996497ff0b15d8ab167ffcd5309daf63e81e4844c122937f9883b3f7d2

Contents?: true

Size: 197 Bytes

Versions: 15

Compression:

Stored size: 197 Bytes

Contents

class Time

  # Truncate time at give range (in seconds).
  #
  #   t = Time.now
  #   =>
  #   t.trunc(60*60) # 1 hour
  #   =>
  #
  def trunc(amount)
    self - (self.to_i % amount)
  end

end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
facets-2.8.4 lib/core/facets/time/trunc.rb
facets-2.8.3 lib/core/facets/time/trunc.rb
facets-2.8.2 lib/core/facets/time/trunc.rb
facets-2.8.1 lib/core/facets/time/trunc.rb
facets-2.8.0 lib/core/facets/time/trunc.rb
facets-2.7.0 lib/core/facets/time/trunc.rb
facets-2.6.0 lib/core/facets/time/trunc.rb
facets-2.4.2 lib/core/facets/time/trunc.rb
facets-2.4.3 lib/core/facets/time/trunc.rb
facets-2.4.4 lib/core/facets/time/trunc.rb
facets-2.5.0 lib/core/facets/time/trunc.rb
facets-2.5.1 lib/core/facets/time/trunc.rb
facets-2.4.5 lib/core/facets/time/trunc.rb
facets-2.5.2 lib/core/facets/time/trunc.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/time/trunc.rb