Class: Pacioli::PostingRuleValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/pacioli/validations/posting_rule_validator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#posting_ruleObject

Returns the value of attribute posting_rule.



3
4
5
# File 'lib/pacioli/validations/posting_rule_validator.rb', line 3

def posting_rule
  @posting_rule
end

Class Method Details

.for(posting_rule) ⇒ Object



5
6
7
8
9
# File 'lib/pacioli/validations/posting_rule_validator.rb', line 5

def self.for(posting_rule)
  validator = new
  validator.posting_rule = posting_rule
  validator
end

Instance Method Details

#executeObject



11
12
13
# File 'lib/pacioli/validations/posting_rule_validator.rb', line 11

def execute
  raise Pacioli::PostingRuleNotBalancedException, "The aggregate balance of debits and credits must be equal" unless self.posting_rule.balanced?
end