aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2012-05-05 02:24:57 -0400
committerMarc-Andre Lafortune <github@marc-andre.ca>2012-05-05 02:43:41 -0400
commit3ea70f985b1799c27b907724920e5615018e505d (patch)
tree1fbdc93902474f4c3f8f515007094015020ec007
parent206b43a954dc6c6c0b4b3916cade2561413efdb5 (diff)
downloadrails-3ea70f985b1799c27b907724920e5615018e505d.tar.gz
rails-3ea70f985b1799c27b907724920e5615018e505d.tar.bz2
rails-3ea70f985b1799c27b907724920e5615018e505d.zip
Use respond_to_missing? for OrderedOptions
-rw-r--r--activesupport/lib/active_support/ordered_options.rb2
-rw-r--r--activesupport/test/ordered_options_test.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb
index 538e41e0eb..60e6cd55ad 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -36,7 +36,7 @@ module ActiveSupport #:nodoc:
end
end
- def respond_to?(name)
+ def respond_to_missing?(name, include_private)
true
end
end
diff --git a/activesupport/test/ordered_options_test.rb b/activesupport/test/ordered_options_test.rb
index 3526c7a366..f60f9a58e3 100644
--- a/activesupport/test/ordered_options_test.rb
+++ b/activesupport/test/ordered_options_test.rb
@@ -77,4 +77,12 @@ class OrderedOptionsTest < ActiveSupport::TestCase
assert copy.kind_of?(original.class)
assert_not_equal copy.object_id, original.object_id
end
+
+ def test_introspection
+ a = ActiveSupport::OrderedOptions.new
+ assert a.respond_to?(:blah)
+ assert a.respond_to?(:blah=)
+ assert_equal 42, a.method(:blah=).call(42)
+ assert_equal 42, a.method(:blah).call
+ end
end