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