y_support 2.0.39 → 2.0.41

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
  SHA1:
3
- metadata.gz: ed2dababbc49adf84a88b8412d7d8a52d2106c5c
4
- data.tar.gz: afbdb0ab6c8a7dada0c501a4757b01b850afeba6
3
+ metadata.gz: 041097d80afc1ead73b89331896a4f6a05611202
4
+ data.tar.gz: 6e3de3d44c9511e2aef3238fb6eecefdd9a60794
5
5
  SHA512:
6
- metadata.gz: 52cc87bbe3e00e2ba464787745f4f2ea246423c7f0e530666c05aa88397c1cefb2dddfcb6d61dc4ed0e810f32b97053bad2cc7ea2cfa9715e4592f8627dbaccb
7
- data.tar.gz: 25f0078f9df59bbec95f830f5fb3702ad7e6e2b046e5f420bd64ae73437ae2bc3a8fc876ea529d9c2d978efcf7b8f6f6699ee4013240dcc3b7e3465e0f20b6c0
6
+ metadata.gz: 47239b7932974d93fbede51895edd6721c8fb48b4dbfb7199d684d285fdc0f61332bd6d0daa42b1c62ba9955cad908855583111dfebb846ec40b514a895f49cb
7
+ data.tar.gz: 2f6bc25b5807cc6e3ac89335e23b12e5fcdc410253c6f19af0b3a37296b121438cbcebf1cd424c29e9939496105a845a25d59e336928dbd4ff2c2618c1be7be1
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'matrix'
2
4
 
3
5
  class Array
@@ -102,7 +104,17 @@ class Array
102
104
  other.map { |e| index e }
103
105
  end
104
106
 
105
- # TEST ME
107
+ # TEST ME ** FUCK OFF TESTS
108
+
109
+ # Pretty-prints the array as line, with prescribed +:precision+ and +:gap+
110
+ # (both are named arguments).
111
+ #
112
+ def print_as_line precision: 2, distance: precision + 4
113
+ element_strings = map { |e| "%.#{precision}f" % e rescue "%s" % e }
114
+ .map { |ς| "%- #{distance}s" % ς[ 0, distance ] }
115
+ puts element_strings.join
116
+ end
117
+
106
118
  # def pretty_inspect
107
119
  # each_slice( 4 ) { |slice|
108
120
  # slice.map { |e|
@@ -142,12 +142,12 @@ class Hash
142
142
  #
143
143
  def pretty_print_numeric_values gap: 0, precision: 2
144
144
  key_strings = keys.map &:to_s
145
- value_strings = values.map do |n| "%.#{precision}e" % n rescue "%s" % s end
146
- lmax, rmax = keys_strings.map( &:size ).max, values_strings.map( &:size ).max
145
+ value_strings = values.map { |n| "%.#{precision}f" % n rescue "%s" % s }
146
+ lmax, rmax = key_strings.map( &:size ).max, value_strings.map( &:size ).max
147
147
  lgap = gap / 2
148
148
  rgap = gap - lgap
149
149
  key_strings.zip( value_strings ).map do |kς, vς|
150
- "%- #{lmax+lgap+1}s%#{rmax+rgap+1}.#{precision}e" % [ kς, vς ]
150
+ "%- #{lmax+lgap+1}s%#{rmax+rgap+1}.#{precision}f" % [ kς, vς ]
151
151
  end.each { |line| puts line }
152
152
  return nil
153
153
  end
@@ -1,4 +1,4 @@
1
1
  module YSupport
2
- VERSION = "2.0.39"
2
+ VERSION = "2.0.41"
3
3
  DEBUG = false
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.39
4
+ version: 2.0.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris