Class: Greenenvy::NameValidator
- Inherits:
-
Object
- Object
- Greenenvy::NameValidator
- Defined in:
- lib/greenenvy/name_validator.rb
Instance Method Summary collapse
-
#initialize(name_checker) ⇒ NameValidator
constructor
A new instance of NameValidator.
- #validate!(name) ⇒ Object
Constructor Details
#initialize(name_checker) ⇒ NameValidator
Returns a new instance of NameValidator.
3 4 5 |
# File 'lib/greenenvy/name_validator.rb', line 3 def initialize(name_checker) @name_checker = name_checker end |
Instance Method Details
#validate!(name) ⇒ Object
7 8 9 10 11 |
# File 'lib/greenenvy/name_validator.rb', line 7 def validate!(name) unless @name_checker.valid?(name) raise Exceptions::InvalidKey, "Invalid key, #{name}." end end |