Class: Hash
Instance Method Summary collapse
-
#_select ⇒ Object
An implementation of select that returns a Hash.
Instance Method Details
#_select ⇒ Object
An implementation of select that returns a Hash.
47 48 49 50 51 52 53 54 55 |
# File 'lib/has_many_polymorphs/support_methods.rb', line 47 def _select if RUBY_VERSION >= "1.9" Hash[*self.select {|k, v| yield k, v }.flatten] else Hash[*self.select do |key, value| yield key, value end._flatten_once] end end |