Created
August 31, 2017 23:59
-
-
Save twe4ked/3b398c71c4c01d055f2ae969f6955285 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
module Sequel | |
class Dataset | |
alias_method :execute_orig, :execute | |
def execute(*args, &block) | |
SequelNotifications.subscribers.each do |subscriber| | |
subscriber.call(*args, &block) | |
end | |
execute_orig(*args, &block) | |
end | |
end | |
end |
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
class SequelNotifications | |
class << self | |
attr_accessor :subscribers | |
end | |
@subscribers = [] | |
def self.subscribe(&callback) | |
@subscribers << callback | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment