File: recorded_call.rb

package info (click to toggle)
ruby-rr 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,424 kB
  • sloc: ruby: 11,405; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 865 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module RR
  class RecordedCall < Struct.new(:subject,
                                  :method_name,
                                  :arguments,
                                  :keyword_arguments,
                                  :block)
    def inspect
      '[%s, %s, %s, %s, %s]' % [
        subject_to_s,
        method_name.inspect,
        arguments.inspect,
        keyword_arguments.inspect,
        block.inspect
      ]
    end

    def ==(other)
      other.is_a?(self.class) &&
        subject == other.subject &&
        method_name == other.method_name &&
        arguments == other.arguments &&
        keyword_arguments == other.keyword_arguments
    end

    private

    def subject_to_s
      if subject.respond_to?(:__rr__original_to_s, true)
        subject.__rr__original_to_s
      else
        subject.to_s
      end
    end
  end
end