pueri 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f588e2eede9595531d3c3f974ce6abb71089180353ffd2934d2c1e3604d56b1
4
- data.tar.gz: fb14b72c9c15fa964a360a9552ed017eb580ad619b03337951a488d256c55a96
3
+ metadata.gz: e6ba46055aa80656a2d982c5a80dd70a38f51706bc7eb7d6cf53f327e4695522
4
+ data.tar.gz: 27d0d365013582129131ae72f3b40f77300c31ed897f89669618b5411e282e0a
5
5
  SHA512:
6
- metadata.gz: 4a2387fa2b80b88101e62d4851d550009b95b19b65a9ac853951f4205d7e600908b82ade84e47a3dde3953b35f5c92d74bd9a6f9cd0d9f0984f46d7786e6eb15
7
- data.tar.gz: 82ef5c2a79e5c8beacc6c7091ea7d3d9724b30eb8fa601b96d0cfd79d4add59da653ea3142cb72ba1071a12331d0fafa3215eda5fb08cb00a01efc1feba94334
6
+ metadata.gz: 3485877c8725ba9632fc168f919a44794cce1859413f65ea2fdec8018d767f99e52a1d1236baf285aa9973f36cfedf76e95773de4f1bc621bf061f0a0266acfc
7
+ data.tar.gz: 584bf81e59ab7b87d7ba7496adfdf3e2b961a5129d0fc0d3ecfc1e6561ce0492f39d191b096c5ce2d5ff3399aa250eff341184aabf78b8c660ce836c1a897765
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.4] - `2019-10-28`
11
+
12
+ ### Changed
13
+ * Included prettified output for `DoseCalc`'s `to_s` method.
14
+ * Included prettified output for `DoseCheck`'s `to_s` method.
15
+
10
16
  ## [0.11.2] - `2019-10-28`
11
17
 
12
18
  ### Added
@@ -37,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
37
43
  [PNI]: http://www.saude.gov.br/saude-de-a-z/vacinacao/calendario-vacinacao
38
44
  [DNPM]: https://www.fcm.unicamp.br/fcm/neuropediatria-conteudo-didatico/desenvolvimento-neuropsicomotor
39
45
 
40
- [Unreleased]: https://github.com/Nereare/pueri/compare/v0.11.2...HEAD
46
+ [Unreleased]: https://github.com/Nereare/pueri/compare/v0.11.4...HEAD
47
+ [0.11.4]: https://github.com/Nereare/pueri/compare/v0.11.2...v0.11.4
41
48
  [0.11.2]: https://github.com/Nereare/pueri/compare/v0.7.0...v0.11.2
42
49
  [0.7.0]: https://github.com/Nereare/pueri/releases/tag/v0.7.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pueri (0.11.2)
4
+ pueri (0.11.4)
5
5
  pastel (~> 0.7.3)
6
6
  tty-table (~> 0.11.0)
7
7
 
@@ -28,11 +28,16 @@ module Pueri
28
28
  # Outputs the calculated dosage into a prescription string.
29
29
  #
30
30
  # @return [String] The prescription string.
31
- def to_s
32
- [
33
- "- #{@name} #{@concentration.to_i}#{@conc_unit.join '/'}",
34
- "Tomar #{@result}#{@conc_unit[1]} #{time_to_s} #{days_to_s}."
35
- ].join "\n"
31
+ def to_s(pretty = false)
32
+ if pretty
33
+ pretty_to_s
34
+ else
35
+ [
36
+ '',
37
+ "- #{@name} #{@concentration.to_i}#{@conc_unit.join '/'}",
38
+ "Tomar #{@result}#{@conc_unit[1]} #{time_to_s} #{days_to_s}."
39
+ ].join "\n"
40
+ end
36
41
  end
37
42
 
38
43
  # Outputs the calculated dosage for each taking. _E.g._ +3.7+, as in _use
@@ -45,6 +50,27 @@ module Pueri
45
50
 
46
51
  private
47
52
 
53
+ def pre_pretty_to_s
54
+ p = Pastel.new
55
+ qtt = p.cyan(@result, @conc_unit[1])
56
+ time = @time.to_i.to_s.rjust(2, '0')
57
+ time = p.cyan(time, '/', time, 'h')
58
+ days = p.cyan(@days.to_s.rjust(2, '0'), ' dias')
59
+
60
+ [qtt, time, days]
61
+ end
62
+
63
+ def pretty_to_s
64
+ p = Pastel.new
65
+ qtt, time, days = pre_pretty_to_s
66
+ [
67
+ '',
68
+ "#{p.cyan('1.')} #{@name} #{@concentration.to_i}"\
69
+ "#{@conc_unit.join('/')} ".ljust(90, '-'),
70
+ " Dar #{qtt} de #{time} por #{days}."
71
+ ].join("\n")
72
+ end
73
+
48
74
  def time_to_s
49
75
  if @time == 24.0
50
76
  'uma vez por dia'
@@ -28,11 +28,16 @@ module Pueri
28
28
  # Outputs the calculated dosage as a string.
29
29
  #
30
30
  # @return [String] The dosage-per-weight-day string.
31
- def to_s
32
- [
33
- "#{@name} #{@concentration.to_i}#{@conc_unit.join '/'} (#{usage})",
34
- "-> Dose de #{@result}#{@conc_unit[0]}/kg/d."
35
- ].join "\n"
31
+ def to_s(pretty = false)
32
+ if pretty
33
+ pretty_to_s
34
+ else
35
+ [
36
+ '',
37
+ "#{@name} #{@concentration.to_i}#{@conc_unit.join '/'} (#{usage})",
38
+ " - Dose de #{@result}#{@conc_unit[0]}/kg/d."
39
+ ].join "\n"
40
+ end
36
41
  end
37
42
 
38
43
  # Outputs the calculated dosage-per-weight-day as a float.
@@ -44,6 +49,16 @@ module Pueri
44
49
 
45
50
  private
46
51
 
52
+ def pretty_to_s
53
+ p = Pastel.new
54
+ [
55
+ '',
56
+ "#{p.cyan(@name, ' ', @concentration.to_i, @conc_unit.join('/'))} "\
57
+ "(#{usage}) ".ljust(90, '-'),
58
+ " - Dose de #{p.cyan(@result, @conc_unit[0], '/kg/d')}."
59
+ ].join("\n")
60
+ end
61
+
47
62
  def usage
48
63
  time = @time.to_i
49
64
  "#{@dose}#{@dose_unit} #{@way} #{time}/#{time}h por #{@days.to_i}d"
data/lib/pueri/version.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # of Immunization (PNI), using the 2019 uptade.
7
7
  module Pueri
8
8
  # Sets the current version of the gem
9
- @version = '0.11.2'
9
+ @version = '0.11.4'
10
10
 
11
11
  # Returns the Gem's current version.
12
12
  #
data/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "Pueri",
3
3
  "description": "Um script em Ruby para ajudar o dia-a-dia de médicos e enfermeiros de Atenção Básica.",
4
- "version": "0.11.2",
4
+ "version": "0.11.4",
5
5
  "maintainers": [
6
6
  {
7
7
  "name": "Igor Padoim",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pueri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Padoim