Parent

Class Index [+]

Quicksearch

Spec::Matchers::OperatorMatcher

Public Class Methods

get(klass, operator) click to toggle source
    # File lib/spec/matchers/operator_matcher.rb, line 15
15:         def get(klass, operator)
16:           registry[klass] && registry[klass][operator]
17:         end
new(actual) click to toggle source
    # File lib/spec/matchers/operator_matcher.rb, line 20
20:       def initialize(actual)
21:         @actual = actual
22:       end
register(klass, operator, matcher) click to toggle source
    # 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
registry() click to toggle source
   # File lib/spec/matchers/operator_matcher.rb, line 6
6:         def registry
7:           @registry ||= {}
8:         end
use_custom_matcher_or_delegate(operator) click to toggle source
    # 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

Public Instance Methods

description() click to toggle source
    # File lib/spec/matchers/operator_matcher.rb, line 42
42:       def description
43:         "#{@operator} #{@expected.inspect}"
44:       end
fail_with_message(message) click to toggle source
    # File lib/spec/matchers/operator_matcher.rb, line 38
38:       def fail_with_message(message)
39:         Spec::Expectations.fail_with(message, @expected, @actual)
40:       end

Private Instance Methods

eval_match(actual, operator, expected) click to toggle source
    # 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.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.