class Croesus::Base

Attributes

errors[RW]
hash[RW]
validations[RW]

Public Class Methods

new(hash, validations) click to toggle source
# File lib/croesus/validations.rb, line 24
def initialize(hash, validations)
  self.errors      = {}
  self.hash        = hash
  self.validations = validations.inject({
    }){ |memo,(k,v)| memo[k] = v.to_s.downcase; memo }
  validate
end
validate(hash, validations) click to toggle source
# File lib/croesus/validations.rb, line 36
def self.validate(hash, validations)
  new(hash, validations)
end

Public Instance Methods

valid?() click to toggle source
# File lib/croesus/validations.rb, line 32
def valid?
  errors.empty?
end