Module: Riffer::Helpers::Validations
- Included in:
- Agent
- Defined in:
- lib/riffer/helpers/validations.rb
Overview
Helper module for input validation.
Instance Method Summary collapse
-
#validate_is_string!(value, name = "value") ⇒ Object
Validates that a value is a non-empty string.
Instance Method Details
#validate_is_string!(value, name = "value") ⇒ Object
Validates that a value is a non-empty string.
Raises Riffer::ArgumentError if the value is not a string or is empty.
– : (untyped, ?String) -> true
12 13 14 15 16 17 |
# File 'lib/riffer/helpers/validations.rb', line 12 def validate_is_string!(value, name = "value") raise Riffer::ArgumentError, "#{name} must be a String" unless value.is_a?(String) raise Riffer::ArgumentError, "#{name} cannot be empty" if value.strip.empty? true end |