Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better use #remove_possible_method here #388

Merged
merged 1 commit into from
May 8, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions activesupport/lib/active_support/core_ext/date/conversions.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'date'
require 'active_support/inflector/methods'
require 'active_support/core_ext/date/zones'
require 'active_support/core_ext/module/remove_method'

class Date
DATE_FORMATS = {
Expand All @@ -13,10 +14,10 @@ class Date
}

# Ruby 1.9 has Date#to_time which converts to localtime only.
remove_method :to_time if method_defined?(:to_time)
remove_possible_method :to_time

# Ruby 1.9 has Date#xmlschema which converts to a string without the time component.
remove_method :xmlschema if method_defined?(:xmlschema)
remove_possible_method :xmlschema

# Convert to a formatted string. See DATE_FORMATS for predefined formats.
#
Expand Down