Class: DebtCeiling::Debt

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

Constant Summary collapse

DoNotWhitelistAndBlacklistSimulateneously =
Class.new(StandardError)

Instance Method Summary collapse

Methods included from CommonMethods

#+, #configuration

Constructor Details

#initialize(file_attributes) ⇒ Debt

Returns a new instance of Debt.



15
16
17
18
19
20
21
# File 'lib/debt_ceiling/debt.rb', line 15

def initialize(file_attributes)
  @file_attributes  = file_attributes
  if valid_debt?
    debt_components = configuration.debt_types.map {|type| type.new(file_attributes) }
    @debt_amount    = debt_components.reduce(&:+)
  end
end

Instance Method Details

#letter_gradeObject



27
28
29
# File 'lib/debt_ceiling/debt.rb', line 27

def letter_grade
  rating.to_s.downcase.to_sym
end

#nameObject



23
24
25
# File 'lib/debt_ceiling/debt.rb', line 23

def name
  analysed_module.name || path.to_s.split('/').last
end