cotcube-helpers 0.1.7 → 0.1.7.1

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: 91263c1bbd453c5b1e6c8a3cfe7c0dee3542f5873e82d15caf8118b6b20ce603
4
- data.tar.gz: f886c9fe330f439b61c0aee1f3c9cc55b3df161511968c25bb92df5cb85c2f0c
3
+ metadata.gz: c53dd160cd7774a8808b28681dd7ad363cb46f7b69ae402d89c190e531060837
4
+ data.tar.gz: 0f0731c06b715e753c73685f7acc967881b616410edde425705f43c38df601fc
5
5
  SHA512:
6
- metadata.gz: '00591395a0289380b4063ffa6766073d7619d1f7cc0576afb722854cbdc97f03d5bd651feaaf6a5f49de61770f6d16982a3ae7de26a9fd030c40efec6198e9f5'
7
- data.tar.gz: c25f08c4677106ec7dc714653830bb6f9ef668f70df50343c443f0d0c79dccd110bf425fe7fa8cdc28b7ecf18db2d3aafd7cccd5f00b2bb5f3a8113fc17f65fa
6
+ metadata.gz: 3920e5754a1b8ae41f8d0ebe83502d9935766b08da022367694fe0ed4591e7c759378a8badca27e0672851fb7599ad97ceff1986146add4285ce4386d8e5852a
7
+ data.tar.gz: 419275382240a93ad604cb32208b57e1b9e3cbf9db95bd0853b80b0fe4a29c10d162af2a20d801c5cb19fd04296d6519b442d66786e5bc56d82ee4f0da37b841
@@ -1,3 +1,6 @@
1
+ ## 0.1.7.1 (January 17, 2021)
2
+ - bugfix
3
+
1
4
  ## 0.1.7 (January 17, 2021)
2
5
  - added new method 'simple_series_stats'
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.7.1
@@ -16,6 +16,7 @@ require_relative 'cotcube-helpers/datetime_ext'
16
16
  require_relative 'cotcube-helpers/subpattern'
17
17
  require_relative 'cotcube-helpers/parallelize'
18
18
  require_relative 'cotcube-helpers/simple_output'
19
+ require_relative 'cotcube-helpers/simple_series_stats'
19
20
  require_relative 'cotcube-helpers/input'
20
21
  require_relative 'cotcube-helpers/reduce'
21
22
 
@@ -24,6 +25,7 @@ module Cotcube
24
25
  module_function :sub,
25
26
  :parallelize,
26
27
  :reduce,
28
+ :simple_series_stats,
27
29
  :keystroke
28
30
 
29
31
  # please not that module_functions of source provided in private files must be published there
@@ -5,7 +5,7 @@ module Cotcube
5
5
  module Helpers
6
6
  # if given a block, :ind of base is set by block.call()
7
7
  # dim reduces the sample size by top n% and least n%, so dim of 0.5 would remove 100% of the sample
8
- def simple_series_stats(base:, ind: nil, dim: 0, format: '%5.2f', print: true, &block)
8
+ def simple_series_stats(base:, ind: nil, dim: 0, format: '% 6.2f', prefix: '', print: true, &block)
9
9
  raise ArgumentError, 'Need :ind of type integer' if base.first.is_a?(Array) and not ind.is_a?(Integer)
10
10
  raise ArgumentError, 'Need :ind to evaluate base' if base.first.is_a?(Hash) and ind.nil?
11
11
 
@@ -37,15 +37,16 @@ module Cotcube
37
37
  result[:upper] = worker[ (result[:size] * 3 / 4).round ]
38
38
  result[:max] = worker.last
39
39
 
40
- result[:output] = result.
40
+ output = result.
41
41
  reject{|k,_| k == :size}.
42
42
  map{|k,v| { type: k, value: v, output: "#{k}: #{format(format, v)}".colorize(k==:avg ? :light_yellow : :white) } }.
43
43
  sort_by{|x| x[:value]}.
44
44
  map{|x| x[:output]}
45
- output = "[" +
46
- " size: #{format '%6d', result[:size]} | ".light_white +
47
- output.join(' | ') +
48
- " ]"
45
+ result[:output] = "#{format '%20s',(prefix.empty? ? '' : (prefix + ': '))}" +
46
+ "[" +
47
+ " size: #{format '%6d', result[:size]} | ".light_white +
48
+ output.join(' | ') +
49
+ " ]"
49
50
 
50
51
  puts result[:output] if print
51
52
  result
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cotcube-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin L. Tischendorf