Class: Deep::Matchers::KeyNameMatchers

Inherits:
Object
  • Object
show all
Defined in:
parser/spec/lib/deep/hash_enclosed_in_array.rb

Overview

Simple class to be inherited by other matcher classes that take String expectation.

Direct Known Subclasses

KeyNamesOfEnclosedHash

Instance Method Summary (collapse)

Constructor Details

- (KeyNameMatchers) initialize(expectation)

A new instance of KeyNameMatchers

Raises:

  • (ArgumentError)


25
26
27
28
29
# File 'parser/spec/lib/deep/hash_enclosed_in_array.rb', line 25

def initialize(expectation)
  expectation = expectation.to_s.downcase
  @expectation = expectation.singularize
  raise ArgumentError, "#{expectation} must have singular form. Got #{@expectation}" if @expectation == expectation
end