class method
self.new
Ruby on Rails 3.2.22.5
Since v3.2.22.5 Last seen in v3.2.22.5Signature
self.new(*args, &block)
In MRI the Hash class is core and written in C. In particular, methods are programmed with explicit C function calls and polymorphism is not honored.
For example, []= is crucial in this implementation to maintain the @keys array but hash.c invokes rb_hash_aset() originally. This prevents method reuse through inheritance and forces us to reimplement stuff.
For instance, we cannot use the inherited #merge! because albeit the algorithm itself would work, our []= is not being called at all by the C code.
Parameters
-
argsrest -
blockblock
Source
# File activesupport/lib/active_support/ordered_hash.rb, line 68
def initialize(*args, &block)
super
@keys = []
end
Defined in activesupport/lib/active_support/ordered_hash.rb line 68
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::OrderedHash