Ruby hash exclude? -


i have check string in hash

 h = {'a'=>'firsthaha','b'=>'sjdh'} 

it's work:

hash.select { |_,v| v.to_s.downcase.include? 'first' }.keys 

but how realize vice versa include?

hash.select { |_,v| v.to_s.downcase.????? 'first' }.keys 

without using active-support exclude?

hash.select { |_,v| !v.to_s.downcase.include? 'first' }.keys #or  hash.reject { |_,v| v.to_s.downcase.include? 'first' }.keys 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -