Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/hash_expecting.rb

Overview

Extends the Hash class to support optionoid option parsing.

Instance Method Summary collapse

Instance Method Details

#checking(keys = nil) ⇒ Object

Perform soft checking on the Hash. Soft checking will not raise an error. Errors are logged and can be checked with errors and failed? methods.



13
14
15
# File 'lib/hash_expecting.rb', line 13

def checking(keys = nil)
  Optionoids::Checker.new(self, keys: keys, hard: false)
end

#expecting(keys = nil) ⇒ Object

Perform hard checking on the Hash. Hard checking will raise an error if the Hash does not conform to the expectations.



7
8
9
# File 'lib/hash_expecting.rb', line 7

def expecting(keys = nil)
  Optionoids::Checker.new(self, keys: keys)
end