Skip to content

Instantly share code, notes, and snippets.

@twe4ked
Created August 31, 2017 23:59
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 twe4ked/3b398c71c4c01d055f2ae969f6955285 to your computer and use it in GitHub Desktop.
Save twe4ked/3b398c71c4c01d055f2ae969f6955285 to your computer and use it in GitHub Desktop.
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
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