Class: PathValidator

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/log_parser/path_validator.rb

Overview

Vaidates the webpath (slug)

Constant Summary

Constants included from Constants

Constants::DEFAULT_LOG, Constants::DEFAULT_OPTIONS, Constants::DESCRIPTORS, Constants::INFO_TITLES, Constants::LOG_WARNINGS, Constants::OPTION_DESCRIPTIONS, Constants::OUTPUT_COLORS, Constants::VALIDATION_NAMES, Constants::VALID_ADDRESS, Constants::VALID_IP4, Constants::VALID_IP6, Constants::VALID_LOG, Constants::VALID_PATH, Constants::WARNINGS_JSON, Constants::WARNING_COLORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ PathValidator

Returns a new instance of PathValidator.



9
10
11
# File 'lib/log_parser/path_validator.rb', line 9

def initialize(path:)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/log_parser/path_validator.rb', line 7

def path
  @path
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/log_parser/path_validator.rb', line 13

def valid?
  path.match(VALID_PATH)
end