A recording that represents an event raise it contains argument variations that can be matched too
Initializes a new instance of a method call recording every time a method gets called in an isolated object this gets stored in the method call recorder It expects a method_name at the very least.
# File lib/caricature/clr/method_call_recorder.rb, line 23 23: def initialize(event_name, count=0) 24: @event_name = event_name 25: @count = count 26: @variations = [] 27: end
add an argument variation
# File lib/caricature/clr/method_call_recorder.rb, line 40 40: def add_argument_variation(args, block) 41: variation = find_argument_variations args 42: if variation.empty? 43: @variations << ArgumentRecording.new(args, @variations.size+1, block) if variation == [] 44: else 45: variation.first.call_number += 1 46: end 47: end
add args
# File lib/caricature/clr/method_call_recorder.rb, line 30 30: def args 31: @variations 32: end
finds an argument variation that matches the provided args
# File lib/caricature/clr/method_call_recorder.rb, line 50 50: def find_argument_variations(args) 51: return @variations if args.first.is_a?(Symbol) and args.last == :any 52: @variations.select { |ar| ar.args == args } 53: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.