def initialize(type, *args, &block)
@type = type
raise ArgumentError, 'Type must be :before, :after, :around, or :failure' unless [:before, :after, :around, :failure].include?(type)
options = args.last.is_a?(Hash) ? args.pop : {}
@methods = args
@methods.concat(Array(options.delete(:do)))
@methods << block if block_given?
raise ArgumentError, 'Method(s) for callback must be specified' unless @methods.any?
options = {:bind_to_object => self.class.bind_to_object, :terminator => self.class.terminator}.merge(options)
bind_to_object = options.delete(:bind_to_object)
@methods.map! do |method|
bind_to_object && method.is_a?(Proc) ? bound_method(method) : method
end
@terminator = options.delete(:terminator)
@branch = Branch.new(options)
end