aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-15 12:21:04 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-15 12:21:04 -0800
commiteeea1a26ec7bd5e11caa4630ff7820c1c7f762e3 (patch)
tree3b193dba9756b45e1a0a70d47faa4c3e2ff946a9 /activesupport
parent1304b664924bfea54fd6dc0dc924ae3d126ff92d (diff)
parent4f984c9d0e66601a81cb5ae6e3b50582e6dc0c2d (diff)
downloadrails-eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3.tar.gz
rails-eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3.tar.bz2
rails-eeea1a26ec7bd5e11caa4630ff7820c1c7f762e3.zip
Merge branch 'master' into testing
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG9
-rw-r--r--activesupport/lib/active_support/option_merger.rb8
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb7
-rw-r--r--activesupport/lib/active_support/version.rb2
-rw-r--r--activesupport/test/option_merger_test.rb8
-rw-r--r--activesupport/test/time_zone_test.rb2
6 files changed, 28 insertions, 8 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index e77affc315..ded72be2f2 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,6 +1,11 @@
-*2.2.1 [RC2 or 2.2 final]*
+*2.3.0/3.0*
-* Added render :js for people who want to render inline JavaScript replies without using RJS [DHH]
+* Added lambda merging to OptionMerger (especially useful with named_scope and with_options) #726 [Paweł Kondzior]
+
+
+*2.2.1 [RC2] (November 14th, 2008)*
+
+* Increment the version of our altered memcache-client to prevent confusion caused when the 1.5.0 gem is installed.
* Fixed the option merging in Array#to_xml #1126 [Rudolf Gavlas]
diff --git a/activesupport/lib/active_support/option_merger.rb b/activesupport/lib/active_support/option_merger.rb
index b563b093ed..63662b75c7 100644
--- a/activesupport/lib/active_support/option_merger.rb
+++ b/activesupport/lib/active_support/option_merger.rb
@@ -10,7 +10,13 @@ module ActiveSupport
private
def method_missing(method, *arguments, &block)
- arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
+ if arguments.last.is_a?(Proc)
+ proc = arguments.pop
+ arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) }
+ else
+ arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
+ end
+
@context.__send__(method, *arguments, &block)
end
end
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 4991f71683..1d87fa64b5 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -304,7 +304,8 @@ module ActiveSupport
"Mexico City", "Monterrey", "Central America" ],
[-18_000, "Eastern Time (US & Canada)", "Indiana (East)", "Bogota",
"Lima", "Quito" ],
- [-14_400, "Atlantic Time (Canada)", "Caracas", "La Paz", "Santiago" ],
+ [-16_200, "Caracas" ],
+ [-14_400, "Atlantic Time (Canada)", "La Paz", "Santiago" ],
[-12_600, "Newfoundland" ],
[-10_800, "Brasilia", "Buenos Aires", "Georgetown", "Greenland" ],
[ -7_200, "Mid-Atlantic" ],
@@ -325,9 +326,9 @@ module ActiveSupport
[ 14_400, "Abu Dhabi", "Muscat", "Baku", "Tbilisi", "Yerevan" ],
[ 16_200, "Kabul" ],
[ 18_000, "Ekaterinburg", "Islamabad", "Karachi", "Tashkent" ],
- [ 19_800, "Chennai", "Kolkata", "Mumbai", "New Delhi" ],
+ [ 19_800, "Chennai", "Kolkata", "Mumbai", "New Delhi", "Sri Jayawardenepura" ],
[ 20_700, "Kathmandu" ],
- [ 21_600, "Astana", "Dhaka", "Sri Jayawardenepura", "Almaty",
+ [ 21_600, "Astana", "Dhaka", "Almaty",
"Novosibirsk" ],
[ 23_400, "Rangoon" ],
[ 25_200, "Bangkok", "Hanoi", "Jakarta", "Krasnoyarsk" ],
diff --git a/activesupport/lib/active_support/version.rb b/activesupport/lib/active_support/version.rb
index 8f5395fca6..6631f233f1 100644
--- a/activesupport/lib/active_support/version.rb
+++ b/activesupport/lib/active_support/version.rb
@@ -2,7 +2,7 @@ module ActiveSupport
module VERSION #:nodoc:
MAJOR = 2
MINOR = 2
- TINY = 0
+ TINY = 1
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff --git a/activesupport/test/option_merger_test.rb b/activesupport/test/option_merger_test.rb
index 0d72314880..f26d61617d 100644
--- a/activesupport/test/option_merger_test.rb
+++ b/activesupport/test/option_merger_test.rb
@@ -64,6 +64,14 @@ class OptionMergerTest < Test::Unit::TestCase
end
end
end
+
+ def test_nested_method_with_options_using_lamdba
+ local_lamdba = lambda { { :lambda => true } }
+ with_options(@options) do |o|
+ assert_equal @options.merge(local_lamdba.call),
+ o.method_with_options(local_lamdba).call
+ end
+ end
# Needed when counting objects with the ObjectSpace
def test_option_merger_class_method
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 515ffcf0bf..d999b9f2a8 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -51,7 +51,7 @@ class TimeZoneTest < Test::Unit::TestCase
define_method("test_utc_offset_for_#{name}") do
silence_warnings do # silence warnings raised by tzinfo gem
- period = zone.tzinfo.period_for_utc(Time.utc(2006,1,1,0,0,0))
+ period = zone.tzinfo.period_for_utc(Time.utc(2009,1,1,0,0,0))
assert_equal period.utc_offset, zone.utc_offset
end
end