aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-01-25 06:59:09 -0800
committerJosé Valim <jose.valim@gmail.com>2012-01-25 06:59:09 -0800
commit148f849ca5c1e3dc033aefca93afcabf4040583e (patch)
tree0e70d86275f8dd1c6345fc000903833f05a90156 /activesupport/lib/active_support/core_ext/date_time
parenta3b36438861934fdacbcff318bd692cbc5d73268 (diff)
parentf54b8468c739055164aa8f51e9680c43a51c4381 (diff)
downloadrails-148f849ca5c1e3dc033aefca93afcabf4040583e.tar.gz
rails-148f849ca5c1e3dc033aefca93afcabf4040583e.tar.bz2
rails-148f849ca5c1e3dc033aefca93afcabf4040583e.zip
Merge pull request #4524 from nashby/datetime-18-code
remove ruby 1.8 related code
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_time')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb15
1 files changed, 0 insertions, 15 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/conversions.rb b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
index d7b3ad7d8d..e5f895478a 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -58,32 +58,17 @@ class DateTime
alias_method :default_inspect, :inspect
alias_method :inspect, :readable_inspect
- # Converts self to a Ruby Date object; time portion is discarded.
- def to_date
- ::Date.new(year, month, day)
- end unless instance_methods(false).include?(:to_date)
-
# Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class.
# If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time.
def to_time
self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec, sec_fraction * 1000000) : self
end
- # To be able to keep Times, Dates and DateTimes interchangeable on conversions.
- def to_datetime
- self
- end unless instance_methods(false).include?(:to_datetime)
-
def self.civil_from_format(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0)
offset = utc_or_local.to_sym == :local ? local_offset : 0
civil(year, month, day, hour, min, sec, offset)
end
- # Converts datetime to an appropriate format for use in XML.
- def xmlschema
- strftime("%Y-%m-%dT%H:%M:%S%Z")
- end unless instance_methods(false).include?(:xmlschema)
-
# Converts self to a floating-point number of seconds since the Unix epoch.
def to_f
seconds_since_unix_epoch.to_f