Parent

Included Modules

Class Index [+]

Quicksearch

RSpec::Matchers::BuiltIn::Include

Public Class Methods

new(*expected) click to toggle source
   # File lib/rspec/matchers/built_in/include.rb, line 7
7:         def initialize(*expected)
8:           super(expected)
9:         end

Public Instance Methods

description() click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 20
20:         def description
21:           "include#{expected_to_sentence}"
22:         end
diffable?() click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 24
24:         def diffable?
25:           true
26:         end
does_not_match?(actual) click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 15
15:         def does_not_match?(actual)
16:           @actual = actual
17:           perform_match(:none?, :any?, actual, expected)
18:         end
matches?(actual) click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 11
11:         def matches?(actual)
12:           perform_match(:all?, :all?, super(actual), expected)
13:         end

Private Instance Methods

comparing_hash_keys?(actual, expected) click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 42
42:         def comparing_hash_keys?(actual, expected)
43:           actual.is_a?(Hash) && !expected.is_a?(Hash)
44:         end
comparing_hash_values?(actual, expected) click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 46
46:         def comparing_hash_values?(actual, expected)
47:           actual.is_a?(Hash) && expected.is_a?(Hash)
48:         end
perform_match(predicate, hash_predicate, actuals, expecteds) click to toggle source
    # File lib/rspec/matchers/built_in/include.rb, line 30
30:         def perform_match(predicate, hash_predicate, actuals, expecteds)
31:           expecteds.send(predicate) do |expected|
32:             if comparing_hash_values?(actuals, expected)
33:               expected.send(hash_predicate) {|k,v| actuals[k] == v}
34:             elsif comparing_hash_keys?(actuals, expected)
35:               actuals.has_key?(expected)
36:             else
37:               actuals.include?(expected)
38:             end
39:           end
40:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.