Class: Hash

Inherits:
Object show all
Defined in:
lib/has_many_polymorphs/support_methods.rb

Instance Method Summary collapse

Instance Method Details

#_selectObject

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