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

#default_value, human_name, #required?, #validate

Methods included from Common

#default, #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] = {}
end

Instance Method Details

#keys(object) ⇒ Object



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

def keys(object)
  options[:keys] = coerce_keys_schemas(object)
  self
end