Skip to content

Instantly share code, notes, and snippets.

@sub
Created February 22, 2011 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sub/839151 to your computer and use it in GitHub Desktop.
Save sub/839151 to your computer and use it in GitHub Desktop.
def separate_gift(task)
gift = {}
[:gift_quantity, :unit_price, :gift_type, :supplier].each do |prop|
gift["#{prop}"] = task["#{prop}"]
task.delete("#{prop}")
end
# task.delete("active_gift")
gift["task_id"] = task["id"]
[task, gift]
end
def separate_encoding(task)
encoding = {}
[:coding_hour_price, :coding_unit_price, :coding_quantity, :coding_hours].each do |prop|
encoding["#{prop}"] = task["#{prop}"]
task.delete("#{prop}")
end
# task.delete("active_gift")
encoding["task_id"] = task["id"]
[task, encoding]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment