Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails filter hashes by key value

{ :a => 1, :b => 2, :c => 3 }.select { |k, v| k != :a && v.even? } # => { :b => 2 }
Source by riptutorial.com #
 
PREVIOUS NEXT
Tagged: #rails #filter #hashes #key
ADD COMMENT
Topic
Name
4+1 =