Parent

Files

Caricature::MethodCallRecording

A recording that represents a method call it contains argument variations that can be matched too

Attributes

method_name[RW]

gets or sets the method name

count[RW]

gets or sets the amount of times the method was called

args[RW]

gets or sets the arguments for this method call

block[RW]

gets or sets the block for this method call

Public Class Methods

new(method_name, count=0) click to toggle source

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/method_call_recorder.rb, line 56
56:     def initialize(method_name, count=0)
57:       @method_name = method_name
58:       @count = count
59:       @variations = []
60:     end

Public Instance Methods

add_argument_variation(args, block) click to toggle source

add an argument variation

    # File lib/caricature/method_call_recorder.rb, line 73
73:     def add_argument_variation(args, block)
74:       variation = find_argument_variations args
75:       @variations << ArgumentRecording.new(args, @variations.size+1, block) if variation == []
76:     end
args() click to toggle source

add args

    # File lib/caricature/method_call_recorder.rb, line 63
63:     def args
64:       @variations
65:     end
find_argument_variations(args) click to toggle source

finds an argument variation that matches the provided args

    # File lib/caricature/method_call_recorder.rb, line 79
79:     def find_argument_variations(args)
80:       return @variations if args.first.is_a?(Symbol) and args.first == :any
81:       @variations.select { |ar| ar.args == args }
82:     end
has_argument_variations?() click to toggle source

indicates if it has an argument variation

    # File lib/caricature/method_call_recorder.rb, line 68
68:     def has_argument_variations?
69:       @variations.size > 1
70:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.