Class: Lab42::Options::Validator
- Inherits:
-
Object
- Object
- Lab42::Options::Validator
- Extended by:
- Forwarder
- Defined in:
- lib/lab42/options/validator.rb
Instance Attribute Summary collapse
-
#missing ⇒ Object
readonly
Returns the value of attribute missing.
-
#spurious ⇒ Object
readonly
Returns the value of attribute spurious.
Instance Method Summary collapse
Instance Attribute Details
#missing ⇒ Object (readonly)
Returns the value of attribute missing.
8 9 10 |
# File 'lib/lab42/options/validator.rb', line 8 def missing @missing end |
#spurious ⇒ Object (readonly)
Returns the value of attribute spurious.
8 9 10 |
# File 'lib/lab42/options/validator.rb', line 8 def spurious @spurious end |
Instance Method Details
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/lab42/options/validator.rb', line 14 def valid? missing.empty? && spurious.empty? end |
#validate(parsed) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/lab42/options/validator.rb', line 18 def validate parsed parsed.each do | key, value | @spurious.update key => value unless @allowed.include? key @missing.delete key if @missing.include? key end end |