Created
February 22, 2011 17:05
-
-
Save sub/838991 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
['gift', 'encoding'].each do |param| | |
eval <<EOC | |
task["active_#{param}"]=="on" ? active_#{param} = true : active_#{param} = false | |
task["active_#{param}"] = active_#{param} | |
active_#{param} = true if task["active_#{param}"] | |
task, #{param} = separate_#{param}(task) | |
EOC | |
end | |
puts "#{active_gift} active_gift" | |
puts "#{active_encoding} active_encoding" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
initial code was
task["active_gift"]=="on" ? active_gift = true : active_gift = false
task["active_gift"] = active_gift
active_gift = true if task["active_gift"]
task, gift = separate_gift(task)