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
Post a Comment