Class: DearInventory::Validator
- Inherits:
-
Object
- Object
- DearInventory::Validator
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dear_inventory/validator.rb
Direct Known Subclasses
DearInventory::Validators::Boolean, DearInventory::Validators::DateTime, DearInventory::Validators::Enum, DearInventory::Validators::Guid, DearInventory::Validators::Integer, DearInventory::Validators::Required, DearInventory::Validators::String
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(field_name, value, options: DEFAULT_OPTIONS) ⇒ Validator
constructor
A new instance of Validator.
Constructor Details
#initialize(field_name, value, options: DEFAULT_OPTIONS) ⇒ Validator
Returns a new instance of Validator.
39 40 41 42 43 44 45 46 47 |
# File 'lib/dear_inventory/validator.rb', line 39 def initialize(field_name, value, options: DEFAULT_OPTIONS) @field_name = T.let(field_name, Symbol) @value = T.let(value, T.nilable(T.any(Date, Numeric, String, T::Boolean, Time))) @limit = T.let([:limit], T.nilable(Integer)) @max_length = T.let([:limit], T.nilable(Integer)) @values = T.let([:values], T.nilable(T::Array[String])) end |
Class Method Details
.call(field_name, value, options: DEFAULT_OPTIONS) ⇒ Object
28 29 30 |
# File 'lib/dear_inventory/validator.rb', line 28 def self.call(field_name, value, options: DEFAULT_OPTIONS) new(field_name, value, options: ).call end |