Sha256: b3e828997dd78289a4927229153f3319058a1d8d805178fcbeb79fd64d572cd7

Contents?: true

Size: 210 Bytes

Versions: 10

Compression:

Stored size: 210 Bytes

Contents

class Time

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

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/time/trunc.rb
facets-3.1.0 lib/core/facets/time/trunc.rb
facets-3.0.0 lib/core/facets/time/trunc.rb
facets-2.9.3 lib/core/facets/time/trunc.rb
facets-2.9.2 src/core/facets/time/trunc.rb
facets-2.9.2 lib/core/facets/time/trunc.rb
facets-2.9.1 lib/core/facets/time/trunc.rb
facets-2.9.0 lib/core/facets/time/trunc.rb
facets-2.9.0.pre.2 lib/core/facets/time/trunc.rb
facets-2.9.0.pre.1 lib/core/facets/time/trunc.rb