Class: NormalizedHash::Matchers::KeyNameMatchers

Inherits:
Object
  • Object
show all
Defined in:
lib/normalized_hash/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

#initialize(expectation) ⇒ KeyNameMatchers

Returns a new instance of KeyNameMatchers.

Raises:

  • (ArgumentError)


25
26
27
28
29
# File 'lib/normalized_hash/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