Sha256: f1fd6eaace955a0062d4418ddb60e3a6f760d87be4f866bec0ba6f52d5b03931
Contents?: true
Size: 780 Bytes
Versions: 1
Compression:
Stored size: 780 Bytes
Contents
# class DateTime # # # Adds seconds and returns a new DateTime object # def add_seconds(secs) # self + (secs.to_f / 1.day) # end # # # Subtracts seconds and returns a new DateTime object # def minus_seconds(secs) # self - (secs.to_f / 1.day) # end # # end require 'date' require 'time' DateTime.instance_eval do # Adds seconds and returns a new DateTime object end module Mack module Facets module DateTime def add_seconds(secs) # self + (secs / 1.day.to_i) self.since(secs) end # Subtracts seconds and returns a new DateTime object def minus_seconds(secs) # self - (secs / 1.day.to_i) self.ago(secs) end end end end DateTime.send(:include, Mack::Facets::DateTime)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mack-facets-0.8.3 | lib/mack-facets/extensions/date_time.rb |