Class: Planik::Lohnausweis::Rechnung
- Defined in:
- lib/lohnausweis/daten_eintrag.rb
Instance Attribute Summary
Attributes inherited from Eintrag
#ansatz, #einheit, #menge, #name
Instance Method Summary collapse
- #betrag ⇒ Object
-
#initialize(name, positive, negative, einheit = "Fr") ⇒ Rechnung
constructor
A new instance of Rechnung.
Methods inherited from Eintrag
#ansatz_to_s, #betrag_gerundet_to_s, #menge_to_s
Constructor Details
#initialize(name, positive, negative, einheit = "Fr") ⇒ Rechnung
Returns a new instance of Rechnung.
124 125 126 127 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 124 def initialize name, positive, negative, einheit = "Fr" super(name, nil, nil, einheit) @positive, @negative = positive, negative end |
Instance Method Details
#betrag ⇒ Object
129 130 131 132 133 134 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 129 def betrag v = 0 v = @positive.inject(v) { |v, x| v + x.betrag } v = @negative.inject(v) { |v, x| v - x.betrag } v end |