lib/sass/callbacks.rb in haml-edge-3.1.73 vs lib/sass/callbacks.rb in haml-edge-3.1.74
- old
+ new
@@ -21,10 +21,24 @@
# @example Use a callback
# m = Munger.new
# m.on_string_munged {|str, res| puts "#{str} was munged into #{res}!"}
# m.munge "bar" #=> bar was munged into bbaarr!
module Callbacks
+ # Automatically includes {InstanceMethods}
+ # when something extends this module.
+ #
+ # @param base [Module]
+ def self.extended(base)
+ base.send(:include, InstanceMethods)
+ end
protected
+
+ module InstanceMethods
+ # Removes all callbacks registered against this object.
+ def clear_callbacks!
+ @_sass_callbacks = {}
+ end
+ end
# Define a callback with the given name.
# This will define an `on_#{name}` method
# that registers a block,
# and a `run_#{name}` method that runs that block