wip
Alpha Chen 9 years ago
parent 7bae49bd92
commit 7792d82971

@ -15,7 +15,15 @@ cars: 2
perfumes: 1 perfumes: 1
FACTS FACTS
puts sues.select {|sue,data| facts.select {|k,_| data.keys.include?(k) }.all? {|k,v| data[k] == v }} facts_gt = Hash[%w[ cats trees ].map {|k| [k,facts[k]] }]
facts_lt = Hash[%w[ pomeranians goldfish ].map {|k| [k,facts[k]] }]
%w[ cats trees pomeranians goldfish ].each {|k| facts.delete(k) }
puts sues.select {|sue,data|
facts.select {|k,_| data.keys.include?(k) }.all? {|k,v| data[k] == v } &&
facts_gt.select {|k,_| data.keys.include?(k) }.all? {|k,v| data[k] > v } &&
facts_lt.select {|k,_| data.keys.include?(k) }.all? {|k,v| data[k] < v }
}
__END__ __END__
Sue 1: goldfish: 9, cars: 0, samoyeds: 9 Sue 1: goldfish: 9, cars: 0, samoyeds: 9

Loading…
Cancel
Save