Class: Philiprehberger::SchemaValidator::Field
- Inherits:
-
Object
- Object
- Philiprehberger::SchemaValidator::Field
- Defined in:
- lib/philiprehberger/schema_validator/field.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#in ⇒ Object
readonly
Returns the value of attribute in.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#of ⇒ Object
readonly
Returns the value of attribute of.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Instance Method Summary collapse
-
#initialize(name, type, required: true, default: nil, format: nil, in: nil, min: nil, max: nil, of: nil, schema: nil, length: nil, &validator) ⇒ Field
constructor
rubocop:disable Metrics/ParameterLists.
- #required? ⇒ Boolean
Constructor Details
#initialize(name, type, required: true, default: nil, format: nil, in: nil, min: nil, max: nil, of: nil, schema: nil, length: nil, &validator) ⇒ Field
rubocop:disable Metrics/ParameterLists
8 9 10 11 12 13 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 8 def initialize(name, type, required: true, default: nil, format: nil, in: nil, min: nil, max: nil, # rubocop:disable Metrics/ParameterLists of: nil, schema: nil, length: nil, &validator) assign_basic_attrs(name, type, required, default, format) assign_constraint_attrs(binding.local_variable_get(:in), min, max, of, schema, length) @validator = validator end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def default @default end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def format @format end |
#in ⇒ Object (readonly)
Returns the value of attribute in.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def in @in end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def length @length end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def min @min end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def name @name end |
#of ⇒ Object (readonly)
Returns the value of attribute of.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def of @of end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def schema @schema end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def type @type end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
6 7 8 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 6 def validator @validator end |
Instance Method Details
#required? ⇒ Boolean
15 16 17 |
# File 'lib/philiprehberger/schema_validator/field.rb', line 15 def required? @required end |