Class: Xpect::Keys

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

Instance Method Summary collapse

Constructor Details

#initialize(required: {}, optional: {}) ⇒ Keys

Returns a new instance of Keys.



3
4
5
6
7
8
# File 'lib/xpect/keys.rb', line 3

def initialize(required: {}, optional: {})
  raise "required must be a Hash" unless required.is_a?(Hash) && optional.is_a?(Hash)

  @optional = optional
  @required = required
end

Instance Method Details

#conform!(value:, path: []) ⇒ Object



10
11
12
13
# File 'lib/xpect/keys.rb', line 10

def conform!(value:, path: [])
  required = process_required(value, path)
  process_optional(required, value, path)
end