Class: CLIUtils::PrefValidator

Inherits:
Object
  • Object
show all
Includes:
Messaging
Defined in:
lib/cliutils/prefs/pref_validators/pref_validator.rb

Overview

The generic base class for a Pref Validator.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Messaging

#messenger

Instance Attribute Details

#is_validBoolean

Holds whether the validator returned successful or not.

Returns:

  • (Boolean)


10
11
12
# File 'lib/cliutils/prefs/pref_validators/pref_validator.rb', line 10

def is_valid
  @is_valid
end

#messageString

Holds the message to display to the user when the Validator fails.

Returns:



15
16
17
# File 'lib/cliutils/prefs/pref_validators/pref_validator.rb', line 15

def message
  @message
end

Instance Method Details

#validate(text = nil) ⇒ void

This method returns an undefined value.

Validate the Validator!

Parameters:

  • text (String) (defaults to: nil)

Raises:

  • (StandardError)

    if the subclass doesn’t implement this method.



22
23
24
# File 'lib/cliutils/prefs/pref_validators/pref_validator.rb', line 22

def validate(text = nil)
  fail "`validate` method not implemented on caller: #{ self.class }"
end