Class: LetsencryptWebfaction::ArgsParser::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/letsencrypt_webfaction/args_parser/field.rb

Direct Known Subclasses

IntegerField, ListField

Defined Under Namespace

Classes: IntegerField, ListField

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 4

def description
  @description
end

#identifierObject (readonly)

Returns the value of attribute identifier.



4
5
6
# File 'lib/letsencrypt_webfaction/args_parser/field.rb', line 4

def identifier
  @identifier
end

#validatorsObject (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

Returns:

  • (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