# File lib/spec/matchers/operator_matcher.rb, line 15
15: def get(klass, operator)
16: registry[klass] && registry[klass][operator]
17: end
# File lib/spec/matchers/operator_matcher.rb, line 20
20: def initialize(actual)
21: @actual = actual
22: end
# File lib/spec/matchers/operator_matcher.rb, line 10
10: def register(klass, operator, matcher)
11: registry[klass] ||= {}
12: registry[klass][operator] = matcher
13: end
# File lib/spec/matchers/operator_matcher.rb, line 6 6: def registry 7: @registry ||= {} 8: end
# File lib/spec/matchers/operator_matcher.rb, line 24
24: def self.use_custom_matcher_or_delegate(operator)
25: define_method(operator) do |expected|
26: if matcher = OperatorMatcher.get(@actual.class, operator)
27: @actual.send(::Spec::Matchers.last_should, matcher.new(expected))
28: else
29: eval_match(@actual, operator, expected)
30: end
31: end
32: end
# File lib/spec/matchers/operator_matcher.rb, line 48
48: def eval_match(actual, operator, expected)
49: ::Spec::Matchers.last_matcher = self
50: @operator, @expected = operator, expected
51: __delegate_operator(actual, operator, expected)
52: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.