Class: LetsencryptWebfaction::ArgsParser::Field
- Inherits:
-
Object
- Object
- LetsencryptWebfaction::ArgsParser::Field
- Defined in:
- lib/letsencrypt_webfaction/args_parser/field.rb
Direct Known Subclasses
Defined Under Namespace
Classes: IntegerField, ListField
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
-
#initialize(identifier, description, validators = []) ⇒ Field
constructor
A new instance of Field.
- #sanitize(val) ⇒ Object
- #valid?(val) ⇒ Boolean
Constructor Details
#initialize(identifier, description, validators = []) ⇒ Field
Returns a new instance of Field.
6 7 8 9 10 |
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 6 def initialize(identifier, description, validators = []) @identifier = identifier @description = description @validators = validators end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 4 def description @description end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 4 def identifier @identifier end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
4 5 6 |
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 4 def validators @validators end |
Instance Method Details
#sanitize(val) ⇒ Object
12 13 14 |
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 12 def sanitize(val) val end |
#valid?(val) ⇒ Boolean
16 17 18 |
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 16 def valid?(val) validators.reject { |validator| validator.valid?(val) }.empty? end |