Class: Pueri::Vax
- Inherits:
-
Object
- Object
- Pueri::Vax
- Defined in:
- lib/pueri/vax.rb
Overview
Gets input from child vaccination calendar for children (PNI) and an age in days. With this, process which vaccines are due by that age.
Instance Attribute Summary collapse
-
#calendar ⇒ Object
readonly
Returns the value of attribute calendar.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(norm_age) ⇒ Vax
constructor
A new instance of Vax.
-
#parse_notes ⇒ String
Retrieves the notes for the vaccination calendar, prettified.
Constructor Details
#initialize(norm_age) ⇒ Vax
Returns a new instance of Vax.
10 11 12 13 14 |
# File 'lib/pueri/vax.rb', line 10 def initialize(norm_age) init_base @range = calc_range(norm_age) parse_calendar end |
Instance Attribute Details
#calendar ⇒ Object (readonly)
Returns the value of attribute calendar.
7 8 9 |
# File 'lib/pueri/vax.rb', line 7 def calendar @calendar end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
7 8 9 |
# File 'lib/pueri/vax.rb', line 7 def header @header end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
7 8 9 |
# File 'lib/pueri/vax.rb', line 7 def notes @notes end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
8 9 10 |
# File 'lib/pueri/vax.rb', line 8 def range @range end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
8 9 10 |
# File 'lib/pueri/vax.rb', line 8 def table @table end |
Instance Method Details
#parse_notes ⇒ String
Retrieves the notes for the vaccination calendar, prettified.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pueri/vax.rb', line 19 def parse_notes r = '' max = @notes.size p = Pastel.new @notes.each_with_index do |line, k| pre = ' ' * (max - (k + 1)) pre += '*' * (k.to_i + 1) r += "\n#{p.cyan(pre)} #{line}" end r end |