Skip to content
This repository
Browse code

ordered_options will work if inherited from Hash, remove OrderedHash …

…usage
  • Loading branch information...
commit cd641fa96efba71efddae0c055ae2a76aaac6a43 1 parent 12e2405
Vishnu Atrai authored
4  activesupport/lib/active_support/ordered_options.rb
... ...
@@ -1,5 +1,3 @@
1  
-require 'active_support/ordered_hash'
2  
-
3 1
 # Usually key value pairs are handled something like this:
4 2
 #
5 3
 #   h = {}
@@ -17,7 +15,7 @@
17 15
 #   h.girl # => 'Mary'
18 16
 #
19 17
 module ActiveSupport #:nodoc:
20  
-  class OrderedOptions < OrderedHash
  18
+  class OrderedOptions < Hash
21 19
     alias_method :_get, :[] # preserve the original #[] method
22 20
     protected :_get # make it protected
23 21
 

3 notes on commit cd641fa

Gabriel Sobrinho

OrderedOptions quacks like a OpenStruct.

Any reason to not use OpenStruct? :)

Vishnu Atrai

OpenStruct does not support element assignment and Element retrieve methods like []= and [], also railties configuration use methods size and delete etc. those are not supported by OpenStruct.

Gabriel Sobrinho

good to know!

Please sign in to comment.
Something went wrong with that request. Please try again.