Class: LabTech::Summary::Count
- Inherits:
-
Object
- Object
- LabTech::Summary::Count
- Defined in:
- app/models/lab_tech/summary/count.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#n ⇒ Object
readonly
Returns the value of attribute n.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(name, n, total, label = nil) ⇒ Count
constructor
A new instance of Count.
- #to_s ⇒ Object
- #zero? ⇒ Boolean
Constructor Details
#initialize(name, n, total, label = nil) ⇒ Count
Returns a new instance of Count.
7 8 9 10 11 12 |
# File 'app/models/lab_tech/summary/count.rb', line 7 def initialize(name, n, total, label = nil) @name = name @n = n @total = total @label = label || name.to_s end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
5 6 7 |
# File 'app/models/lab_tech/summary/count.rb', line 5 def label @label end |
#n ⇒ Object (readonly)
Returns the value of attribute n.
5 6 7 |
# File 'app/models/lab_tech/summary/count.rb', line 5 def n @n end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'app/models/lab_tech/summary/count.rb', line 5 def name @name end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
5 6 7 |
# File 'app/models/lab_tech/summary/count.rb', line 5 def total @total end |
Instance Method Details
#to_s ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/models/lab_tech/summary/count.rb', line 18 def to_s "%s of %s (%s) %s" % [ humanize( n ), humanize( total ), rate( n ), label ] end |
#zero? ⇒ Boolean
14 15 16 |
# File 'app/models/lab_tech/summary/count.rb', line 14 def zero? n.zero? end |