class RockBooks::Account

The ChartOfAccount holds the set of all these accounts for the entity.

Constants

PERMITTED_CODE_CHAR_REGEX

Public Class Methods

new(code, type, name) click to toggle source
Calls superclass method
# File lib/rock_books/types/account.rb, line 14
def initialize(code, type, name)
  validate_code(code)
  super
end

Public Instance Methods

validate_code(code) click to toggle source
# File lib/rock_books/types/account.rb, line 8
def validate_code(code)
  unless PERMITTED_CODE_CHAR_REGEX.match(code)
    raise "Code {#{code}} may only contain letters, numbers, underscores, hyphens, and periods."
  end
end