lib/gumdrop/callbacks.rb in gumdrop-0.6.3 vs lib/gumdrop/callbacks.rb in gumdrop-0.6.4
- old
+ new
@@ -7,14 +7,17 @@
class_eval <<-EOF
def #{name}(*args, &block)
if block
@_#{name} = [] if @_#{name}.nil?
@_#{name} << block
- elsif @_#{name}
+ elsif @_#{name} and !@_#{name}.nil?
@_#{name}.each do |cb|
cb.call(*args)
end
end
+ end
+ def clear_#{name}()
+ @_#{name} = nil
end
EOF
end
end
\ No newline at end of file