Created
May 25, 2011 10:32
-
-
Save timruffles/990749 to your computer and use it in GitHub Desktop.
Revisions
-
timruffles revised this gist
May 25, 2011 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,8 @@ def process_message message process_message do before { "Started #{message.headers["message-id"]}" } after { "Finished #{message.headers["message-id"]}" } method ['PassingGame::Entry','count_active_for'], :after, lambda { "#{active_entries} active entries for match_id = #{match_id}" } method ['JSON','parse'], :after, lambda { logger.debug "Action: #{event['action']}" } end end -
timruffles created this gist
May 25, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ before: def process_message message logger.debug "Started #{message.headers["message-id"]}" event = JSON.parse message.body logger.debug "Action: #{event['action']}" match_id = event['matchID'] active_entries = PassingGame::Entry.count_active_for match_id logger.info "#{active_entries} active entries for match_id = #{match_id}" if fail_on? event fail_entries_for match_id else give_points_to_entries_for match_id end logger.debug "Finished #{message.headers["message-id"]}" end after: log do process_message do before { "Started #{message.headers["message-id"]}" } after { "Finished #{message.headers["message-id"]}" } method ['PassingGame::Entry','count_active_for'], lambda { "#{active_entries} active entries for match_id = #{match_id}" } end end def process_message message event = JSON.parse message.body match_id = event['matchID'] active_entries = PassingGame::Entry.count_active_for match_id if fail_on? event fail_entries_for match_id else give_points_to_entries_for match_id end end