class StackMaster::SparkleFormation::CompileTime::MinLengthValidator
Constants
- KEY
Public Class Methods
new(name, definition, parameter)
click to toggle source
# File lib/stack_master/sparkle_formation/compile_time/min_length_validator.rb, line 10 def initialize(name, definition, parameter) @name = name @definition = definition @parameter = parameter end
Private Instance Methods
check_is_valid()
click to toggle source
# File lib/stack_master/sparkle_formation/compile_time/min_length_validator.rb, line 18 def check_is_valid return true unless @definition[:type] == :string return true unless @definition.key?(KEY) invalid_values.empty? end
create_error()
click to toggle source
# File lib/stack_master/sparkle_formation/compile_time/min_length_validator.rb, line 29 def create_error "#{@name}:#{invalid_values} must be at least #{KEY}:#{@definition[KEY]} characters" end
invalid_values()
click to toggle source
# File lib/stack_master/sparkle_formation/compile_time/min_length_validator.rb, line 24 def invalid_values values = build_values(@definition, @parameter) values.select { |value| value.length < @definition[KEY].to_i} end