Class: Typero::TextType
- Inherits:
-
StringType
- Object
- Type
- StringType
- Typero::TextType
- Defined in:
- lib/typero/type/types/text_type.rb
Constant Summary
Constants inherited from Type
Typero::Type::ERRORS, Typero::Type::OPTS, Typero::Type::OPTS_KEYS
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
Methods inherited from Type
allowed_opt?, #db_field, db_schema, #default, error, #get, #initialize, load, opts, #value
Constructor Details
This class inherits a constructor from Typero::Type
Instance Method Details
#db_schema ⇒ Object
15 16 17 |
# File 'lib/typero/type/types/text_type.rb', line 15 def db_schema [:text, {}] end |
#set ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/typero/type/types/text_type.rb', line 7 def set value(&:to_s) value(&:downcase) if opts[:downcase] error_for(:min_length_error, opts[:min], value.length) if opts[:min] && value.length < opts[:min] error_for(:max_length_error, opts[:max], value.length) if opts[:max] && value.length > opts[:max] end |