Class: Compel::Builder::Array
- Defined in:
- lib/compel/builder/array.rb
Instance Attribute Summary
Attributes inherited from Schema
Instance Method Summary collapse
-
#initialize ⇒ Array
constructor
A new instance of Array.
- #is(value) ⇒ Object
- #items(schema, options = {}) ⇒ Object
Methods inherited from Schema
#build_option, #default_options, #default_value, human_name, #required?, #validate
Methods included from Common
#coerce_if_proc, #default, #if, #length, #max_length, #min_length, #required
Constructor Details
#initialize ⇒ Array
Returns a new instance of Array.
6 7 8 |
# File 'lib/compel/builder/array.rb', line 6 def initialize super(Coercion::Array) end |
Instance Method Details
#is(value) ⇒ Object
18 19 20 |
# File 'lib/compel/builder/array.rb', line 18 def is(value) build_option :is, Coercion.coerce!(value, Coercion::Array) end |
#items(schema, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/compel/builder/array.rb', line 10 def items(schema, = {}) if !schema.is_a?(Schema) raise Compel::TypeError, '#items must be a valid Schema' end build_option :items, schema, end |