Class: Sekisyo::Validators::StringValidator
- Inherits:
-
Object
- Object
- Sekisyo::Validators::StringValidator
- Defined in:
- lib/sekisyo/validators/string_validator.rb
Overview
Sekisyo Validators StringValidator is a validator that accepts only string value.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key, options = {}) ⇒ StringValidator
constructor
A new instance of StringValidator.
- #valid?(value) ⇒ Boolean
Constructor Details
#initialize(key, options = {}) ⇒ StringValidator
Returns a new instance of StringValidator.
9 10 11 12 |
# File 'lib/sekisyo/validators/string_validator.rb', line 9 def initialize(key, = {}) @key = key @options = end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
14 15 16 |
# File 'lib/sekisyo/validators/string_validator.rb', line 14 def key @key end |
Instance Method Details
#valid?(value) ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/sekisyo/validators/string_validator.rb', line 16 def valid?(value) type_validate(value) && presence_validate(value) && bytesize_validate(value) && enum_validate(value) && match_validate(value) end |