From 5fcaf917612c61174f55bbd2301131ccdbec51fb Mon Sep 17 00:00:00 2001 From: Raimonds Simanovskis Date: Tue, 16 Feb 2010 21:43:13 +0200 Subject: fix conditions when DateTime#to_date and DateTime#xmlschema methods are defined --- activesupport/lib/active_support/core_ext/date_time/conversions.rb | 6 +++--- activesupport/test/abstract_unit.rb | 2 +- activesupport/test/core_ext/date_time_ext_test.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'activesupport') 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 24168c7825..c3f0acce25 100644 --- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb @@ -60,7 +60,7 @@ class DateTime # Converts self to a Ruby Date object; time portion is discarded def to_date ::Date.new(year, month, day) - end unless method_defined?(:to_date) + 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 @@ -71,7 +71,7 @@ class DateTime # To be able to keep Times, Dates and DateTimes interchangeable on conversions def to_datetime self - end unless method_defined?(:to_datetime) + 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 @@ -81,7 +81,7 @@ class DateTime # Converts datetime to an appropriate format for use in XML def xmlschema strftime("%Y-%m-%dT%H:%M:%S%Z") - end unless method_defined?(:xmlschema) + end unless instance_methods(false).include?(:xmlschema) # Converts self to a floating-point number of seconds since the Unix epoch def to_f diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index ea6ebca3ce..dd84860a91 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -18,7 +18,7 @@ ENV['NO_RELOAD'] = '1' require 'active_support' # Include shims until we get off 1.8.6 -require 'active_support/ruby/shim' +require 'active_support/ruby/shim' if RUBY_VERSION < '1.8.7' def uses_memcached(test_name) require 'memcache' diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index eba8170cda..19d7935211 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -26,11 +26,11 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase end def test_to_date - assert_equal Date.new(2005, 2, 21), DateTime.new(2005, 2, 21).to_date + assert_equal Date.new(2005, 2, 21), DateTime.new(2005, 2, 21, 14, 30, 0).to_date end def test_to_datetime - assert_equal DateTime.new(2005, 2, 21), DateTime.new(2005, 2, 21).to_datetime + assert_equal DateTime.new(2005, 2, 21, 14, 30, 0), DateTime.new(2005, 2, 21, 14, 30, 0).to_datetime end def test_to_time -- cgit v1.2.3 From 3adb395da4f11693c20cc331271d5927f96acac8 Mon Sep 17 00:00:00 2001 From: Rizwan Reza Date: Mon, 7 Jun 2010 21:52:56 +0430 Subject: Fixed Load Error failures in 1.9.2-head --- activesupport/lib/active_support/core_ext/load_error.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb index 615ebe9588..8bdfa0c5bc 100644 --- a/activesupport/lib/active_support/core_ext/load_error.rb +++ b/activesupport/lib/active_support/core_ext/load_error.rb @@ -3,6 +3,7 @@ class LoadError /^no such file to load -- (.+)$/i, /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, /^Missing API definition file in (.+)$/i, + /^cannot load such file -- (.+)$/i, ] def path -- cgit v1.2.3 From 0042f4166f783085eb909d69d542b5323d8af5d6 Mon Sep 17 00:00:00 2001 From: wycats Date: Mon, 7 Jun 2010 22:31:42 -0400 Subject: If we undef <=>, it solves a problem involving comparison. Please figure out the root cause. --- activesupport/lib/active_support/multibyte/chars.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 429b65bf15..d085280fe7 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -51,6 +51,8 @@ module ActiveSupport #:nodoc: end end + undef <=> + # Forward all undefined methods to the wrapped string. def method_missing(method, *args, &block) if method.to_s =~ /!$/ -- cgit v1.2.3 From 8d576b51a12fdb19e3993f3678ec64b2ea60fada Mon Sep 17 00:00:00 2001 From: wycats Date: Mon, 7 Jun 2010 23:32:20 -0400 Subject: Move the undef into the 1.9 only branch --- activesupport/lib/active_support/multibyte/chars.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index d085280fe7..1eb6e8748b 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -45,14 +45,14 @@ module ActiveSupport #:nodoc: @wrapped_string = string @wrapped_string.force_encoding(Encoding::UTF_8) unless @wrapped_string.frozen? end + + undef <=> else def initialize(string) #:nodoc: @wrapped_string = string end end - undef <=> - # Forward all undefined methods to the wrapped string. def method_missing(method, *args, &block) if method.to_s =~ /!$/ -- cgit v1.2.3 From 068f8d6e85aa0c54bd4531c0e9ef15804b0444de Mon Sep 17 00:00:00 2001 From: wycats Date: Tue, 8 Jun 2010 14:09:34 -0400 Subject: Require encoding.rb --- activesupport/lib/active_support/core_ext/string.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string.rb b/activesupport/lib/active_support/core_ext/string.rb index 411ea0f016..d8d1f9436e 100644 --- a/activesupport/lib/active_support/core_ext/string.rb +++ b/activesupport/lib/active_support/core_ext/string.rb @@ -9,3 +9,4 @@ require 'active_support/core_ext/string/behavior' require 'active_support/core_ext/string/interpolation' require 'active_support/core_ext/string/output_safety' require 'active_support/core_ext/string/exclude' +require 'active_support/core_ext/string/encoding' \ No newline at end of file -- cgit v1.2.3 From 6b49a71ab719319aafa9d0dce4addd815974bafc Mon Sep 17 00:00:00 2001 From: wycats Date: Tue, 8 Jun 2010 14:23:23 -0400 Subject: Missing require restored --- activesupport/lib/active_support/core_ext/file.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/file.rb b/activesupport/lib/active_support/core_ext/file.rb index dc24afbe7f..a763447566 100644 --- a/activesupport/lib/active_support/core_ext/file.rb +++ b/activesupport/lib/active_support/core_ext/file.rb @@ -1 +1,2 @@ require 'active_support/core_ext/file/atomic' +require 'active_support/core_ext/file/path' -- cgit v1.2.3 From 32d4330b8185caa05af6ae69b0769b34b5e159eb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 8 Jun 2010 14:46:26 -0400 Subject: Get ready for beta 4 --- activesupport/CHANGELOG | 2 +- activesupport/lib/active_support/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport') diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 0e24cc138a..6566d3fa06 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,4 +1,4 @@ -*Rails 3.0.0 [beta 4/release candidate] (unreleased)* +*Rails 3.0.0 [beta 4] (June 8th, 2010)* * Extracted String#truncate from TextHelper#truncate [DHH] diff --git a/activesupport/lib/active_support/version.rb b/activesupport/lib/active_support/version.rb index 538a8b87c6..52612c27cb 100644 --- a/activesupport/lib/active_support/version.rb +++ b/activesupport/lib/active_support/version.rb @@ -3,7 +3,7 @@ module ActiveSupport MAJOR = 3 MINOR = 0 TINY = 0 - BUILD = "beta3" + BUILD = "beta4" STRING = [MAJOR, MINOR, TINY, BUILD].join('.') end -- cgit v1.2.3