class DAF::Option
Used to store options - includes the expected type the name, and the value. Also includes validation logic
-
the absence of validation logic in the value= operator is
intentional, as there may be cases where you can set an invalid option value
Attributes
name[R]
type[R]
value[RW]
Public Class Methods
new(name, type, verifier = nil)
click to toggle source
# File lib/daf/configurable.rb, line 127 def initialize(name, type, verifier = nil) @type = type @name = name @verifier = if verifier verifier else true end end
Public Instance Methods
valid?()
click to toggle source
# File lib/daf/configurable.rb, line 137 def valid? !@value.nil? && @value.is_a?(@type) && (@verifier == true || @verifier.call(@value)) end