Class: WebMock::Matchers::HashArgumentMatcher
- Inherits:
-
Object
- Object
- WebMock::Matchers::HashArgumentMatcher
- Defined in:
- lib/webmock/matchers/hash_argument_matcher.rb
Overview
Base class for Hash matchers github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #==(_actual, &block) ⇒ Object
-
#initialize(expected) ⇒ HashArgumentMatcher
constructor
A new instance of HashArgumentMatcher.
Constructor Details
#initialize(expected) ⇒ HashArgumentMatcher
Returns a new instance of HashArgumentMatcher.
6 7 8 |
# File 'lib/webmock/matchers/hash_argument_matcher.rb', line 6 def initialize(expected) @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, deep: true).sort] end |
Class Method Details
.from_rspec_matcher(matcher) ⇒ Object
16 17 18 |
# File 'lib/webmock/matchers/hash_argument_matcher.rb', line 16 def self.from_rspec_matcher(matcher) new(matcher.instance_variable_get(:@expected)) end |
Instance Method Details
#==(_actual, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/webmock/matchers/hash_argument_matcher.rb', line 10 def ==(_actual, &block) @expected.all?(&block) rescue NoMethodError false end |