Sha256: 3bff87bd650a8372817bb737e92ddaab1c85c25dcc10d56b539cf924944de576
Contents?: true
Size: 509 Bytes
Versions: 9
Compression:
Stored size: 509 Bytes
Contents
module Timely class Period attr_reader :number, :units UNITS = [ :seconds, :minutes, :hours, :days, :weeks, :months, :years, :calendar_days, :calendar_months, :calendar_years ] def initialize(number, units) @number = number @units = units.to_sym end def after(time) time.advance_considering_calendar(units, number) end def to_s "#{number} #{units.to_s.gsub('_', '')}" end end end
Version data entries
9 entries across 9 versions & 1 rubygems