Created
April 28, 2011 03:29
-
-
Save ivanacostarubio/945743 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # THE FOLLOWING 3 METHODS LOOK A LOT A LIKE | |
| # A JUICY STEAK AWATING TO BE EATEN | |
| # DUPLICATION SOON TO BE REMOVED | |
| # | |
| # MACHETE! | |
| # | |
| # | |
| def create_lifeboat | |
| q = RightAws::SqsGen2::Queue.create(@cue, "create_" + self.class.to_s.downcase, true) | |
| q.send_message(self.attributes.to_json) | |
| end | |
| def update_lifeboat | |
| q = RightAws::SqsGen2::Queue.create(@cue, "update_" + self.class.to_s.downcase, true) | |
| q.send_message(self.attributes.to_json) | |
| end | |
| def destroy_lifeboat | |
| q = RightAws::SqsGen2::Queue.create(@cue, "destroy_" + self.class.to_s.downcase, true) | |
| q.send_message(self.attributes.to_json) | |
| end | |
| # They can be refactor to: | |
| [:create, :update, :destroy ].each do |action| | |
| define_method(action.to_s + "_lifeboat") do | |
| q = RightAws::SqsGen2::Queue.create(@cue, action.to_s+"_"+ self.class.to_s.downcase, true) | |
| q.send_message(self.attributes.to_json) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment