Skip to content

Instantly share code, notes, and snippets.

@Corgan
Created June 25, 2011 06:08
Show Gist options
  • Save Corgan/a48b612c147df605657a to your computer and use it in GitHub Desktop.
Save Corgan/a48b612c147df605657a to your computer and use it in GitHub Desktop.
newTargets = targets.collect do |target|
v = {:id => target, :energy => target.abs} if target.class == Fixnum && target > 0
v = {:id => target.split(",")[0], :energy => target.split(",")[3].to_i} if target.class == String
v
end.compact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment