lib/ruby_ext/more/callbacks.rb in ruby_ext-0.5.8 vs lib/ruby_ext/more/callbacks.rb in ruby_ext-0.5.9

- old
+ new

@@ -179,21 +179,21 @@ module ClassMethods inheritable_accessor :callbacks, {} def set_callback callback_name, type, *executor_or_options, &block callback_name.must_be.a Symbol - type = type.to_sym #.must_be.a Symbol + type = type.to_sym - # parsing arguments + # Parsing arguments. opt = executor_or_options.extract_options! "You can't provide both method name and block for filter!" if block and !executor_or_options.empty? executor = block || executor_or_options.first type.must_be.in [:before, :around, :after] executor.must_be.defined - # creating callback + # Creating callback. callback = AbstractCallback.new callback = case type when :before then BeforeCallback.new when :around then AroundCallback.new when :after then AfterCallback.new @@ -202,11 +202,9 @@ callback.executor = executor callback.terminator = opt.delete :terminator if type == :before callback.conditions = opt (self.callbacks[callback_name] ||= []) << callback - # callbacks.send(type) << callback - # (callbacks[callback_name][type] ||= []) << callback end end end \ No newline at end of file