class Tengine::Resource::Credential::AuthField
Attributes
default[R]
name[R]
optional[R]
type_key[R]
Public Class Methods
new(name, type_key, options = {})
click to toggle source
# File lib/tengine/resource/credential.rb, line 56 def initialize(name, type_key, options = {}) @name, @type_key = name.to_s, type_key.to_sym @options = options || {} @optional = !!@options[:optional] @default = @options[:default] end
Public Instance Methods
eql?(other)
click to toggle source
# File lib/tengine/resource/credential.rb, line 71 def eql?(other) self.name <=> other.to_s end
hash()
click to toggle source
# File lib/tengine/resource/credential.rb, line 74 def hash self.name.hash end
optional?()
click to toggle source
# File lib/tengine/resource/credential.rb, line 67 def optional? @optional end
to_s()
click to toggle source
# File lib/tengine/resource/credential.rb, line 77 def to_s self.name end
validate(credential, hash)
click to toggle source
# File lib/tengine/resource/credential.rb, line 62 def validate(credential, hash) unless optional credential.errors.add(:auth_values, "#{name.inspect} can't be blank") if hash[name].blank? end end