Class: Compel::Builder::Hash
- Inherits:
-
Schema
- Object
- Schema
- Compel::Builder::Hash
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, #required?
Methods included from Common
#default, #length, #required
Constructor Details
#initialize ⇒ Hash
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(hash) ⇒ Object
12
13
14
15
|
# File 'lib/compel/builder/hash.rb', line 12
def keys(hash)
options[:keys] = hash
self
end
|
#validate(object) ⇒ Object
17
18
19
|
# File 'lib/compel/builder/hash.rb', line 17
def validate(object)
Contract.new(object, self).validate
end
|