Class: Saphyr::Fields::ArrayField

Inherits:
FieldBase
  • Object
show all
Defined in:
lib/saphyr/fields/array_field.rb

Constant Summary collapse

PREFIX =
'array'
EXPECTED_TYPES =
Array
AUTHORIZED_OPTIONS =
[:len, :min, :max, :of_type, :of_schema, :opts]
REQUIRED_ONE_OF_OPTIONS =
[:of_type, :of_schema]
EXCLUSIVE_OPTIONS =
[
  [ :len, [:min, :max] ],
  [ :of_schema, [:opts] ],
]
NOT_EQUALS_OPTIONS =

Cannot have: min == max, use :len instead

[
  [:min, :max],
]
NOT_SUP_OPTIONS =

Cannot have: min > max

[
  [:min, :max],
]

Constants inherited from FieldBase

FieldBase::DEFAULT_OPTS, FieldBase::DEFAULT_OPT_VALUES, FieldBase::NOT_SUP_OR_EQUALS_OPTIONS, FieldBase::REQUIRED_OPTIONS

Constants included from Asserts::ErrorConstants

Asserts::ErrorConstants::ERR_BAD_FORMAT, Asserts::ErrorConstants::ERR_EQ, Asserts::ErrorConstants::ERR_GT, Asserts::ErrorConstants::ERR_GTE, Asserts::ErrorConstants::ERR_IN, Asserts::ErrorConstants::ERR_LEN, Asserts::ErrorConstants::ERR_LT, Asserts::ErrorConstants::ERR_LTE, Asserts::ErrorConstants::ERR_MAX, Asserts::ErrorConstants::ERR_MIN, Asserts::ErrorConstants::ERR_NOT_EMPTY, Asserts::ErrorConstants::ERR_NOT_NULLABLE, Asserts::ErrorConstants::ERR_REGEXP, Asserts::ErrorConstants::ERR_SIZE_EQ, Asserts::ErrorConstants::ERR_SIZE_LEN, Asserts::ErrorConstants::ERR_SIZE_MAX, Asserts::ErrorConstants::ERR_SIZE_MIN, Asserts::ErrorConstants::ERR_TYPE

Instance Attribute Summary

Attributes inherited from FieldBase

#opts

Instance Method Summary collapse

Methods inherited from FieldBase

#authorized_options, #default?, #err, #exclusive_options, #expected_types, #not_equals_options, #not_sup_options, #not_sup_or_equals_options, #nullable?, #prefix, #required?, #required_one_of_options, #required_options, #validate

Methods included from Asserts::StringAssert

#assert_string_regexp

Methods included from Asserts::NumericAssert

#assert_numeric_gt, #assert_numeric_gte, #assert_numeric_lt, #assert_numeric_lte

Methods included from Asserts::SizeAssert

#assert_size_len, #assert_size_max, #assert_size_min

Methods included from Asserts::BaseAssert

#assert_boolean, #assert_class, #assert_eq, #assert_in, #assert_not_empty

Constructor Details

#initialize(opts = {}) ⇒ ArrayField

Returns a new instance of ArrayField.



26
27
28
29
30
31
32
# File 'lib/saphyr/fields/array_field.rb', line 26

def initialize(opts={})
  super

  # TODO : Check that :of_type exists

  # TODO : Check that :of_schema exists
end