Class: Opto::Types::String

Inherits:
Opto::Type show all
Defined in:
lib/opto/types/string.rb

Overview

A string

Options:

- min_length: minimum lenght
- max_length: maximum length
- empty_is_nil: an empty string will be replaced with nil
- encode_64: set to true if you want the final value to be base64 encoded representation
- decode_64: set to true if your string is in base64 and you want to convert to plain text
- upcase: set to true to upcase the string
- downcase: set to true to downcase the string
- strip: set to true to remove leading and trailing whitespace
- chomp: set to true to remove trailing linefeed
- capitalize: set to true to upcase the first letter
- hexdigest: valid options: md5, sha1, sha256, sha384, sha512 and nil/false. generate an md5/sha1/etc hexdigest from the value.

Constant Summary collapse

TRANSFORMATIONS =
[ :upcase, :downcase, :strip, :chomp, :capitalize ]

Constants inherited from Opto::Type

Opto::Type::GLOBAL_OPTIONS

Instance Attribute Summary

Attributes inherited from Opto::Type

#options

Method Summary

Methods inherited from Opto::Type

#errors, for, inherited, #initialize, #required?, #sanitize, sanitizer, sanitizers, true_when, type, #type, types, #valid?, #validate, validator, validators

Constructor Details

This class inherits a constructor from Opto::Type