Skip to content

Instantly share code, notes, and snippets.

@sub
Created February 22, 2011 17:05
Show Gist options
  • Save sub/838991 to your computer and use it in GitHub Desktop.
Save sub/838991 to your computer and use it in GitHub Desktop.
['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"
@sub
Copy link
Author

sub commented Feb 22, 2011

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment