lib/asset_cloud/callbacks.rb in asset_cloud-2.0.0 vs lib/asset_cloud/callbacks.rb in asset_cloud-2.1.0
- old
+ new
@@ -6,20 +6,18 @@
module ClassMethods
def callback_methods(*symbols)
symbols.each do |method|
code = <<-"end_eval"
-
def self.before_#{method}(*callbacks, &block)
callbacks << block if block_given?
write_inheritable_array(:before_#{method}, callbacks)
end
def self.after_#{method}(*callbacks, &block)
callbacks << block if block_given?
write_inheritable_array(:after_#{method}, callbacks)
end
-
def #{method}_with_callbacks(*args)
if execute_callbacks(:before_#{method}, args)
result = #{method}_without_callbacks(*args)
execute_callbacks(:after_#{method}, args)