minutes ActiveSupport::Duration.minutes(self) end alias :minute :minutes def hours ActiveSupport::Duration.hours(self) end alias :hour :hours def days ActiveSupport::Duration.days(self) end alias :day :days def weeks ActiveSupport::Duration.weeks(self) end alias :week :weeks end
SECONDS_PER_DAY = 86400 SECONDS_PER_WEEK = 604800 SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) class << self def weeks(value) new(value * SECONDS_PER_WEEK, [[:weeks, value]]) end end def initialize(value, parts) @value, @parts = value, parts.to_h @parts.default = 0 end end end
SECONDS_PER_DAY = 86400 SECONDS_PER_WEEK = 604800 SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) class << self def weeks(value) new(value * SECONDS_PER_WEEK, [[:weeks, value]]) end end def initialize(value, parts) @value, @parts = value, parts.to_h @parts.default = 0 end end end
SECONDS_PER_DAY = 86400 SECONDS_PER_WEEK = 604800 SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) class << self def weeks(value) new(value * SECONDS_PER_WEEK, [[:weeks, value]]) end end def initialize(value, parts) @value, @parts = value, parts.to_h @parts.default = 0 end end end
SECONDS_PER_DAY = 86400 SECONDS_PER_WEEK = 604800 SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) class << self def weeks(value) new(value * SECONDS_PER_WEEK, [[:weeks, value]]) end end def initialize(value, parts) @value, @parts = value, parts.to_h @parts.default = 0 end end end ඵ ֤୯ҐͱͷΈ߹Θͤ
SECONDS_PER_DAY = 86400 SECONDS_PER_WEEK = 604800 SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) class << self def weeks(value) new(value * SECONDS_PER_WEEK, [[:weeks, value]]) end end def initialize(value, parts) @value, @parts = value, parts.to_h @parts.default = 0 end end end ඵ ֤୯ҐͱͷΈ߹Θͤ \XFFLT^
SECONDS_PER_DAY = 86400 SECONDS_PER_WEEK = 604800 SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) class << self def seconds(value) new(value, [[:seconds, value]]) end def minutes(value) new(value * SECONDS_PER_MINUTE, [[:minutes, value]]) end def hours(value) new(value * SECONDS_PER_HOUR, [[:hours, value]]) end def days(value) new(value * SECONDS_PER_DAY, [[:days, value]]) end def weeks(value) new(value * SECONDS_PER_WEEK, [[:weeks, value]]) end def months(value) new(value * SECONDS_PER_MONTH, [[:months, value]]) end def years(value) new(value * SECONDS_PER_YEAR, [[:years, value]]) end end end end
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end \XFFLT^
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end XFFLT
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end XFFLT
d = d >> options.delete(:years) * 12 if options[:years] d = d >> options.delete(:months) if options[:months] d = d + options.delete(:weeks) * 7 if options[:weeks] d = d + options.delete(:days) if options[:days] d end end \XFFLT^
d = d >> options.delete(:years) * 12 if options[:years] d = d >> options.delete(:months) if options[:months] d = d + options.delete(:weeks) * 7 if options[:weeks] d = d + options.delete(:days) if options[:days] d end end \XFFLT^
d = d >> options.delete(:years) * 12 if options[:years] d = d >> options.delete(:months) if options[:months] d = d + options.delete(:weeks) * 7 if options[:weeks] d = d + options.delete(:days) if options[:days] d end end \XFFLT^ લͷ
d = d >> options.delete(:years) * 12 if options[:years] d = d >> options.delete(:months) if options[:months] d = d + options.delete(:weeks) * 7 if options[:weeks] d = d + options.delete(:days) if options[:days] d end end ݄ͷԋࢉ%BUF
parts.inject(time) do |t, (type, number)| if t.acts_like?(:time) || t.acts_like?(:date) if type == :seconds t.since(sign * number) elsif type == :minutes t.since(sign * number * 60) elsif type == :hours t.since(sign * number * 3600) else t.advance(type => sign * number) end else raise ::ArgumentError, "expected a time or date, got #{time.inspect}" end end end end end