Class: Planik::Lohnausweis::Eintrag
- Inherits:
-
Object
- Object
- Planik::Lohnausweis::Eintrag
- Defined in:
- lib/lohnausweis/daten_eintrag.rb
Overview
Abstrakte Klasse für alle Einträge in den Tabellen des Lohnausweises Ein Eintrag hat vier mögliche Spalten: Name, Menge, Ansatz und Betrag, von denen aber der einte oder andere nil sein kann.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ansatz ⇒ Object
readonly
Returns the value of attribute ansatz.
-
#einheit ⇒ Object
readonly
Returns the value of attribute einheit.
-
#menge ⇒ Object
readonly
Returns the value of attribute menge.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#ansatz_to_s ⇒ Object
Default Wert ist nil.
- #betrag ⇒ Object
- #betrag_gerundet_to_s ⇒ Object
-
#initialize(name, menge, ansatz, einheit = "Fr") ⇒ Eintrag
constructor
A new instance of Eintrag.
-
#menge_to_s ⇒ Object
Die Menge, gerundet auf zwei Kommastellen genau.
Constructor Details
#initialize(name, menge, ansatz, einheit = "Fr") ⇒ Eintrag
Returns a new instance of Eintrag.
12 13 14 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 12 def initialize(name, menge, ansatz, einheit = "Fr") @name, @menge, @ansatz, @einheit= name, menge, ansatz, einheit end |
Instance Attribute Details
#ansatz ⇒ Object (readonly)
Returns the value of attribute ansatz.
10 11 12 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 10 def ansatz @ansatz end |
#einheit ⇒ Object (readonly)
Returns the value of attribute einheit.
10 11 12 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 10 def einheit @einheit end |
#menge ⇒ Object (readonly)
Returns the value of attribute menge.
10 11 12 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 10 def menge @menge end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 10 def name @name end |
Instance Method Details
#ansatz_to_s ⇒ Object
Default Wert ist nil
27 28 29 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 27 def ansatz_to_s nil end |
#betrag ⇒ Object
16 17 18 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 16 def betrag raise "implement in subclass" end |
#betrag_gerundet_to_s ⇒ Object
31 32 33 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 31 def betrag_gerundet_to_s value_gerundet_to_s betrag end |
#menge_to_s ⇒ Object
Die Menge, gerundet auf zwei Kommastellen genau
21 22 23 24 |
# File 'lib/lohnausweis/daten_eintrag.rb', line 21 def menge_to_s return menge if menge.instance_of? String menge.nil? ? nil :format('%.2f', menge) end |