Class: Compel::Builder::Hash

Inherits:
Schema
  • Object
show all
Defined in:
lib/compel/builder/hash.rb

Instance Attribute Summary

Attributes inherited from Schema

#options, #type

Instance Method Summary collapse

Methods inherited from Schema

#build_option, #default_options, #default_value, human_name, #required?, #validate

Methods included from Common

#coerce_if_proc, #default, #if, #is, #length, #max_length, #min_length, #required

Constructor Details

#initializeHash

Returns a new instance of Hash.



6
7
8
9
10
# File 'lib/compel/builder/hash.rb', line 6

def initialize
  super(Coercion::Hash)

  options[:keys] = { value: {} }
end

Instance Method Details

#keys(object, options = {}) ⇒ Object



12
13
14
# File 'lib/compel/builder/hash.rb', line 12

def keys(object, options = {})
  build_option :keys, coerce_keys_schemas(object), options
end