Sha256: 001a0f7f60ab039679da5528eb0ca5269f9793d14f6cbeade1de6ff005bbc28e
Contents?: true
Size: 926 Bytes
Versions: 3
Compression:
Stored size: 926 Bytes
Contents
module LetsencryptWebfaction class ArgsParser class Field attr_reader :identifier, :description, :validators def initialize(identifier, description, validators = []) @identifier = identifier @description = description @validators = validators end def sanitize(val) val end def valid?(val) validators.reject { |validator| validator.valid?(val) }.empty? end def value? true end class IntegerField < Field def sanitize(val) val.to_i end end class ListField < Field def sanitize(val) return val if val.is_a?(Array) val.split(',').map(&:strip).compact end end class BooleanField < Field def sanitize(val) val || false end def value? false end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems