Class: LabTech::Summary::Count

Inherits:
Object
  • Object
show all
Defined in:
app/models/lab_tech/summary/count.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#labelObject (readonly)

Returns the value of attribute label.



5
6
7
# File 'app/models/lab_tech/summary/count.rb', line 5

def label
  @label
end

#nObject (readonly)

Returns the value of attribute n.



5
6
7
# File 'app/models/lab_tech/summary/count.rb', line 5

def n
  @n
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'app/models/lab_tech/summary/count.rb', line 5

def name
  @name
end

#totalObject (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_sObject



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

Returns:

  • (Boolean)


14
15
16
# File 'app/models/lab_tech/summary/count.rb', line 14

def zero?
  n.zero?
end