Class: OptsValidator
- Inherits:
-
Object
- Object
- OptsValidator
- Defined in:
- lib/opts_validator.rb
Instance Method Summary collapse
-
#initialize(options, logger = nil) ⇒ OptsValidator
constructor
A new instance of OptsValidator.
- #validate_presence_of(symbol, description = nil, flag = nil) ⇒ Object
Constructor Details
#initialize(options, logger = nil) ⇒ OptsValidator
Returns a new instance of OptsValidator.
3 4 5 6 |
# File 'lib/opts_validator.rb', line 3 def initialize(, logger = nil) = @logger = logger end |
Instance Method Details
#validate_presence_of(symbol, description = nil, flag = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/opts_validator.rb', line 8 def validate_presence_of(symbol, description = nil, flag = nil) if [symbol].nil? if description.nil? = "You must provide the #{symbol} parameter" else = "You must provide the #{description} parameter" += " (-#{flag} flag)" unless flag.nil? end unless @logger.nil? @logger.error() else puts .red end exit end end |