Sha256: 69b48808d3be633b0ea39d68bcaa1eea4bf1e00e500efbf339d0492cade7d8a2
Contents?: true
Size: 542 Bytes
Versions: 24
Compression:
Stored size: 542 Bytes
Contents
module Pacioli class CompanyValidator attr_accessor :company def self.for(company) validator = new validator.company = company validator end def execute validate_accounts end def validate_accounts accounts = self.company.accounts.map(&:name) raise Pacioli::CompanyAccountException, "The company has multiple accounts with the same name: '#{accounts.detect{ |e| accounts.count(e) > 1 }}' already exists" unless accounts.detect{ |e| accounts.count(e) > 1 }.nil? end end end
Version data entries
24 entries across 24 versions & 1 rubygems