# File lib/more/facets/duration.rb, line 140 def segmented(*segments) self.class.new(@seconds, segments) #segments = segments.collect{ |p| p.to_s.downcase.chomp('s') } #y,w,d,h,m,s = nil,nil,nil,nil,nil,nil #x = @seconds #y, x = *x.divmod(YEAR) if segments.include?('year') #w, x = *x.divmod(WEEK) if segments.include?('week') #d, x = *x.divmod(DAY) if segments.include?('day') #h, x = *x.divmod(HOUR) if segments.include?('hour') #m, x = *x.divmod(MINUTE) if segments.include?('minute') #s = x if segments.include?('second') #[y, w, d, h, m, s].compact end