ninajansen.dk

ninajansen.dk header image 1

Entries from november 2008

Cool complicated logic trick: use eval

november 3rd, 2008 · Comments

So I am working on an application where I have an array where I need to the sum of the values of members of the array, if they fulfill certain conditions. It looks like this:
if !A and !B
array.each do {|a| if (some condition) sum += a }
if A and !B
array.each do {|a| if (some other [...]

[Read more →]

Tags: eval · logic · ruby