Module: TT::Length
- Defined in:
- TT_Lib2/length.rb
Overview
Collection of Length methods.
Class Method Summary collapse
Class Method Details
.snap(length, snap) ⇒ Length
20 21 22 23 24 25 26 27 28 29 |
# File 'TT_Lib2/length.rb', line 20 def self.snap( length, snap ) return length.to_l if snap.zero? diff = length % snap if diff > snap / 2.0 new_length = length - diff + snap else new_length = length - diff end new_length.to_l end |