Sha256: 364d32c95121340ee1dc5d9fdde334154918cf9932153135fd1ab1d8c1b5d3f2
Contents?: true
Size: 576 Bytes
Versions: 15
Compression:
Stored size: 576 Bytes
Contents
module Percheron module Validators class Stack def initialize(stack) @stack = stack end def valid? message = rules.return { |rule| send(rule) } if message raise Errors::StackInvalid.new(message) else true end end private attr_reader :stack def rules [ :validate_name ] end def validate_name 'Name is invalid' if stack.name.nil? || !stack.name.to_s.match(/[\w\d]{3,}/) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems