diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb index aaf1ff2f90..787a619d7a 100644 --- a/activesupport/lib/active_support/ordered_options.rb +++ b/activesupport/lib/active_support/ordered_options.rb @@ -62,6 +62,10 @@ module ActiveSupport def extractable_options? true end + + def inspect + "#<#{self.class.name} #{self}>" + end end # +InheritableOptions+ provides a constructor to build an +OrderedOptions+ diff --git a/activesupport/test/ordered_options_test.rb b/activesupport/test/ordered_options_test.rb index 541b8cddf5..d27ca7ed70 100644 --- a/activesupport/test/ordered_options_test.rb +++ b/activesupport/test/ordered_options_test.rb @@ -115,4 +115,14 @@ class OrderedOptionsTest < ActiveSupport::TestCase end assert_raises(KeyError) { a.non_existing_key! } end + + def test_inspect + a = ActiveSupport::OrderedOptions.new + assert_equal "#", a.inspect + + a.foo = :bar + a[:baz] = :quz + + assert_equal "#:bar, :baz=>:quz}>", a.inspect + end end