Class: Saphyr::Fields::StringField

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

Overview

The string field type

Allowed options are: :eq, :len, :min, :max, :in, :regexp.

Constant Summary collapse

PREFIX =
'string'
EXPECTED_TYPES =
String
AUTHORIZED_OPTIONS =
[:eq, :len, :min, :max, :in, :regexp]
EXCLUSIVE_OPTIONS =
[
  [ :eq, [:_all_] ],
  [ :len, [:eq, :min, :max, :in] ],
  [ :in, [:_all_] ],
]
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_ONE_OF_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

Method Summary

Methods inherited from FieldBase

#authorized_options, #default?, #err, #exclusive_options, #expected_types, #initialize, #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

This class inherits a constructor from Saphyr::Fields::FieldBase