Class: DebtCeiling::Audit

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
CommonMethods
Defined in:
lib/debt_ceiling/audit.rb

Constant Summary collapse

FAILURE_MESSAGE =
"DEBT CEILING FAILURE: "
TOTAL_LIMIT =
"EXCEEDED TOTAL DEBT CEILING "
PER_MODULE_MESSAGE =
"MAX DEBT PER MODULE EXCEEDED IN AT LEAST ONE LOCATION"
MISSED_TARGET_MESSAGE =
"MISSED DEBT REDUCTION TARGET "

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonMethods

#+, #configuration

Constructor Details

#initialize(dir = '.', opts = {}) ⇒ Audit

Returns a new instance of Audit.



19
20
21
22
23
24
25
26
# File 'lib/debt_ceiling/audit.rb', line 19

def initialize(dir = '.', opts = {})
  @loaded     = opts[:preconfigured]
  @dir        = dir
  @accounting = perform_accounting
  accounting.print_results unless opts[:skip_report]
  puts failure_message unless opts[:silent]
  fail_test if failed_condition? && !opts[:warn_only]
end

Instance Attribute Details

#accountingObject (readonly)

Returns the value of attribute accounting.



12
13
14
# File 'lib/debt_ceiling/audit.rb', line 12

def accounting
  @accounting
end

#dirObject (readonly)

Returns the value of attribute dir.



12
13
14
# File 'lib/debt_ceiling/audit.rb', line 12

def dir
  @dir
end

#loadedObject (readonly)

Returns the value of attribute loaded.



12
13
14
# File 'lib/debt_ceiling/audit.rb', line 12

def loaded
  @loaded
end

Instance Method Details

#failed_condition?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/debt_ceiling/audit.rb', line 28

def failed_condition?
  exceeded_total_limit || missed_target || max_debt_per_module_exceeded
end