Parent

Files

Caricature::EventRaiseRecording

A recording that represents an event raise it contains argument variations that can be matched too

Attributes

event_name[RW]

gets or sets the event name

count[RW]

gets or sets the amount of times the event was raised

args[RW]

gets or sets the arguments for this event raise

handler[RW]

gets or sets the block for this event raise

Public Class Methods

new(event_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/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

Public Instance Methods

add_argument_variation(args, block) click to toggle source

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
args() click to toggle source

add args

    # File lib/caricature/clr/method_call_recorder.rb, line 30
30:      def args
31:        @variations
32:      end
find_argument_variations(args) click to toggle source

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
has_argument_variations?() click to toggle source

indicates if it has an argument variation

    # File lib/caricature/clr/method_call_recorder.rb, line 35
35:      def has_argument_variations?
36:        @variations.size > 1
37:      end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.