Method: Immutable::Hash#clear
- Defined in:
- lib/immutable/hash.rb
#clear ⇒ Hash
Return an empty Hash instance, of the same class as this one. Useful if you have multiple subclasses of Hash and want to treat them polymorphically. Maintains the default block, if there is one.
751 752 753 754 755 756 757 |
# File 'lib/immutable/hash.rb', line 751 def clear if @default self.class.alloc(EmptyTrie, @default) else self.class.empty end end |