muflax 0.3.18 → 0.3.19
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile.lock +1 -1
- data/lib/muflax/align.rb +35 -13
- data/muflax.gemspec +1 -1
- data.tar.gz.sig +1 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1d7cf5cadb93be4cc8e7fe1ea28a03f2a69d37c9ffa0342cacf5dac56610b480
         | 
| 4 | 
            +
              data.tar.gz: 4295cf464987fd55013d8b68c569a27458b7f22e6b5bc43590389319dfe0aeab
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 52a6f307763e7815bd3537c2ed380761bf3c40f248eb64e12af9335a04c559860be3482881901a1589d4ed40289479825970a2d195d0a2686360c25a249cd90e
         | 
| 7 | 
            +
              data.tar.gz: 30dcec504bb2950513ef8b2821f49b81b8c204c4096e637e5b95108812eeba4834c3e85769968a6d2b92d4754a9359b49e1028945e51237c615a6b007401e6f1
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/muflax/align.rb
    CHANGED
    
    | @@ -58,24 +58,46 @@ class Array | |
| 58 58 | 
             
                  columns	= [columns, line.size].max
         | 
| 59 59 | 
             
                end
         | 
| 60 60 |  | 
| 61 | 
            -
                #  | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 61 | 
            +
                columns -= 1 # very last column is always un-aligned
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                columns.times.map do |column|
         | 
| 64 | 
            +
                  # calculate column width
         | 
| 65 | 
            +
                  wants    	= []
         | 
| 66 | 
            +
                  new_block	= false
         | 
| 67 | 
            +
                  width    	= 0
         | 
| 68 | 
            +
                  first    	= 0
         | 
| 69 | 
            +
                  max_cols 	= column + 1
         | 
| 65 70 |  | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            +
                  lines.each.with_index do |line, cur|
         | 
| 72 | 
            +
                    if new_block
         | 
| 73 | 
            +
                      new_block	= false
         | 
| 74 | 
            +
                      first    	= cur
         | 
| 75 | 
            +
                      width    	= 0
         | 
| 76 | 
            +
                    end
         | 
| 71 77 |  | 
| 72 | 
            -
                     | 
| 78 | 
            +
                    w	= line[column]&.size
         | 
| 79 | 
            +
                    w	= nil if line.size == max_cols # treat last column as useless
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                    if w.nil? # block done
         | 
| 82 | 
            +
                      wants    	<< [first, cur, width] unless width == 0
         | 
| 83 | 
            +
                      new_block	= true
         | 
| 84 | 
            +
                    else
         | 
| 85 | 
            +
                      width = [width, w].max
         | 
| 86 | 
            +
                    end
         | 
| 73 87 | 
             
                  end
         | 
| 88 | 
            +
                  wants << [first, lines.size, width] unless new_block or width == 0 # last block
         | 
| 74 89 |  | 
| 75 | 
            -
                  #  | 
| 76 | 
            -
                   | 
| 90 | 
            +
                  # justify column
         | 
| 91 | 
            +
                  wants.each do |from, to, width|
         | 
| 92 | 
            +
                    lines[from...to].each do |line|
         | 
| 93 | 
            +
                      if elem = line[column]
         | 
| 94 | 
            +
                        elem_diff   	= elem.to_s.length - elem.str_length # how much the element is internally longer than it appears
         | 
| 95 | 
            +
                        line[column]	= just_function.call(elem, width + elem_diff, column)
         | 
| 96 | 
            +
                      end
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
                  end
         | 
| 77 99 | 
             
                end
         | 
| 78 100 |  | 
| 79 | 
            -
                lines
         | 
| 101 | 
            +
                lines.map{|l| l.join(str)}
         | 
| 80 102 | 
             
              end
         | 
| 81 103 | 
             
            end
         | 
    
        data/muflax.gemspec
    CHANGED
    
    
    
        data.tar.gz.sig
    CHANGED
    
    | @@ -1,2 +1 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            �݇�SBKZY��֙�����IϚ��.*Q%XJ�W2�
         | 
| 1 | 
            +
            ��gZ.�)��ݚh���"����Gi��_v��o�c��_{k�_%fxl���H��z`7��d�G�ƚ�\�!و��H-W+�J��h"T�劍�욟����<4�=�r����s�`/{�	�][��X�:(}OJ���lD���ܛկd�A�O�K.
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: muflax
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.19
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - muflax
         | 
| @@ -28,7 +28,7 @@ cert_chain: | |
| 28 28 | 
             
              jj4QBQUG5hER1ZAFf+RXdy4RSimjXedOgvebDGeTafOJyhtLsxsh6UKCViHVGzkw
         | 
| 29 29 | 
             
              fhGEJ1deAR/i8RPCblyBDtl7Ved3uX8izfU9LItVY+HOAzl69Qp0fe2TYH+y4uCO
         | 
| 30 30 | 
             
              -----END CERTIFICATE-----
         | 
| 31 | 
            -
            date: 2019-02- | 
| 31 | 
            +
            date: 2019-02-11 00:00:00.000000000 Z
         | 
| 32 32 | 
             
            dependencies:
         | 
| 33 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 34 | 
             
              name: awesome_print
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |