tty-table 0.6.0 → 0.7.0
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
- data/.travis.yml +4 -3
- data/CHANGELOG.md +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/README.md +119 -117
- data/lib/tty-table.rb +2 -45
- data/lib/tty/table.rb +12 -0
- data/lib/tty/table/alignment_set.rb +2 -0
- data/lib/tty/table/border.rb +8 -0
- data/lib/tty/table/border/ascii.rb +2 -0
- data/lib/tty/table/border/null.rb +2 -0
- data/lib/tty/table/border/unicode.rb +2 -0
- data/lib/tty/table/border_dsl.rb +3 -0
- data/lib/tty/table/column_constraint.rb +3 -0
- data/lib/tty/table/column_set.rb +2 -0
- data/lib/tty/table/field.rb +4 -0
- data/lib/tty/table/header.rb +3 -0
- data/lib/tty/table/operation/alignment.rb +2 -0
- data/lib/tty/table/operation/padding.rb +2 -0
- data/lib/tty/table/operation/truncation.rb +2 -0
- data/lib/tty/table/operation/wrapped.rb +2 -0
- data/lib/tty/table/orientation.rb +3 -0
- data/lib/tty/table/renderer.rb +4 -0
- data/lib/tty/table/renderer/ascii.rb +3 -0
- data/lib/tty/table/renderer/basic.rb +20 -0
- data/lib/tty/table/renderer/unicode.rb +2 -0
- data/lib/tty/table/row.rb +3 -0
- data/lib/tty/table/version.rb +1 -1
- data/tty-table.gemspec +1 -1
- metadata +5 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2842eafedd508702de25386dd7bce4bd8904f930
         | 
| 4 | 
            +
              data.tar.gz: d4969e9ea05c9bdaea3d98abe20d5326e0e0ea93
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9849f80f8267563b4f884c2888dfa18b6099e9209480b68e792a758179e11f616cc3adc4d95543b09279cd8fd6ad3f26c3ea1a0bf5afebdf9f8f01e4d1571be2
         | 
| 7 | 
            +
              data.tar.gz: f8108b28bbff284e92e128db0d2217bd1f0fb3ea73c0d83ea14689d425133f796f46f774ccadd75818fddef62e01ccaabbe3e57964db3b7f0be58313abeb3927
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,11 @@ | |
| 1 1 | 
             
            # Change log
         | 
| 2 2 |  | 
| 3 | 
            +
            ## [v0.7.0] - 2017-01-15
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Changed
         | 
| 6 | 
            +
            * Change loading of dependencies and required files
         | 
| 7 | 
            +
            * Change pastel dependency version
         | 
| 8 | 
            +
             | 
| 3 9 | 
             
            ## [v0.6.0] - 2016-10-26
         | 
| 4 10 |  | 
| 5 11 | 
             
            ### Changed
         | 
| @@ -57,6 +63,7 @@ | |
| 57 63 |  | 
| 58 64 | 
             
            * Initial implementation and release
         | 
| 59 65 |  | 
| 66 | 
            +
            [v0.7.0]: https://github.com/piotrmurach/tty-table/compare/v0.6.0...v0.7.0
         | 
| 60 67 | 
             
            [v0.6.0]: https://github.com/piotrmurach/tty-table/compare/v0.5.0...v0.6.0
         | 
| 61 68 | 
             
            [v0.5.0]: https://github.com/piotrmurach/tty-table/compare/v0.4.0...v0.5.0
         | 
| 62 69 | 
             
            [v0.4.0]: https://github.com/piotrmurach/tty-table/compare/v0.3.0...v0.4.0
         | 
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            # Contributor Code of Conduct
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            As contributors and maintainers of this project, and in the interest of
         | 
| 4 | 
            +
            fostering an open and welcoming community, we pledge to respect all people who
         | 
| 5 | 
            +
            contribute through reporting issues, posting feature requests, updating
         | 
| 6 | 
            +
            documentation, submitting pull requests or patches, and other activities.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            We are committed to making participation in this project a harassment-free
         | 
| 9 | 
            +
            experience for everyone, regardless of level of experience, gender, gender
         | 
| 10 | 
            +
            identity and expression, sexual orientation, disability, personal appearance,
         | 
| 11 | 
            +
            body size, race, ethnicity, age, religion, or nationality.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Examples of unacceptable behavior by participants include:
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            * The use of sexualized language or imagery
         | 
| 16 | 
            +
            * Personal attacks
         | 
| 17 | 
            +
            * Trolling or insulting/derogatory comments
         | 
| 18 | 
            +
            * Public or private harassment
         | 
| 19 | 
            +
            * Publishing other's private information, such as physical or electronic
         | 
| 20 | 
            +
              addresses, without explicit permission
         | 
| 21 | 
            +
            * Other unethical or unprofessional conduct
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            Project maintainers have the right and responsibility to remove, edit, or
         | 
| 24 | 
            +
            reject comments, commits, code, wiki edits, issues, and other contributions
         | 
| 25 | 
            +
            that are not aligned to this Code of Conduct, or to ban temporarily or
         | 
| 26 | 
            +
            permanently any contributor for other behaviors that they deem inappropriate,
         | 
| 27 | 
            +
            threatening, offensive, or harmful.
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            By adopting this Code of Conduct, project maintainers commit themselves to
         | 
| 30 | 
            +
            fairly and consistently applying these principles to every aspect of managing
         | 
| 31 | 
            +
            this project. Project maintainers who do not follow or enforce the Code of
         | 
| 32 | 
            +
            Conduct may be permanently removed from the project team.
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            This code of conduct applies both within project spaces and in public spaces
         | 
| 35 | 
            +
            when an individual is representing the project or its community.
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be
         | 
| 38 | 
            +
            reported by contacting a project maintainer at [email]. All
         | 
| 39 | 
            +
            complaints will be reviewed and investigated and will result in a response that
         | 
| 40 | 
            +
            is deemed necessary and appropriate to the circumstances. Maintainers are
         | 
| 41 | 
            +
            obligated to maintain confidentiality with regard to the reporter of an
         | 
| 42 | 
            +
            incident.
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            This Code of Conduct is adapted from the [Contributor Covenant][homepage],
         | 
| 45 | 
            +
            version 1.3.0, available at
         | 
| 46 | 
            +
            [http://contributor-covenant.org/version/1/3/0/][version]
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            [homepage]: http://contributor-covenant.org
         | 
| 49 | 
            +
            [version]: http://contributor-covenant.org/version/1/3/0/
         | 
    
        data/README.md
    CHANGED
    
    | @@ -81,13 +81,13 @@ Then simply call `render` on the instance with with border type as first argumen | |
| 81 81 | 
             
            ```ruby
         | 
| 82 82 | 
             
            table.render(:ascii)
         | 
| 83 83 | 
             
            # =>
         | 
| 84 | 
            -
              +-------+-------+
         | 
| 85 | 
            -
              |header1|header2|
         | 
| 86 | 
            -
              +-------+-------+
         | 
| 87 | 
            -
              |a1     |a2     |
         | 
| 88 | 
            -
              +-------+-------+
         | 
| 89 | 
            -
              |b1     |b2     |
         | 
| 90 | 
            -
              +-------+-------+
         | 
| 84 | 
            +
            #  +-------+-------+
         | 
| 85 | 
            +
            #  |header1|header2|
         | 
| 86 | 
            +
            #  +-------+-------+
         | 
| 87 | 
            +
            #  |a1     |a2     |
         | 
| 88 | 
            +
            #  +-------+-------+
         | 
| 89 | 
            +
            #  |b1     |b2     |
         | 
| 90 | 
            +
            #  +-------+-------+
         | 
| 91 91 | 
             
            ```
         | 
| 92 92 |  | 
| 93 93 | 
             
            ## 2. Interface
         | 
| @@ -212,9 +212,9 @@ Once you have an instance of `TTY::Table` you can decorate the content using the | |
| 212 212 | 
             
            ```ruby
         | 
| 213 213 | 
             
            table.render(:basic)
         | 
| 214 214 | 
             
            # =>
         | 
| 215 | 
            -
              header1 header2
         | 
| 216 | 
            -
              a1      a2
         | 
| 217 | 
            -
              b1      b2
         | 
| 215 | 
            +
            #  header1 header2
         | 
| 216 | 
            +
            #  a1      a2
         | 
| 217 | 
            +
            #  b1      b2
         | 
| 218 218 | 
             
            ```
         | 
| 219 219 |  | 
| 220 220 | 
             
            This will use so called `:basic` renderer with default options. The other renderers are `:ascii` and `:unicode`.
         | 
| @@ -268,9 +268,9 @@ renderer = TTY::Table::Renderer::Basic.new(table) | |
| 268 268 | 
             
            ```ruby
         | 
| 269 269 | 
             
            renderer.render
         | 
| 270 270 | 
             
            # =>
         | 
| 271 | 
            -
              header1 header2
         | 
| 272 | 
            -
              a1      a2
         | 
| 273 | 
            -
              b1      b2
         | 
| 271 | 
            +
            #  header1 header2
         | 
| 272 | 
            +
            #  a1      a2
         | 
| 273 | 
            +
            #  b1      b2
         | 
| 274 274 | 
             
            ```
         | 
| 275 275 |  | 
| 276 276 | 
             
            This is the same as calling `render` directly on table:
         | 
| @@ -294,12 +294,12 @@ and then call `render` to get the formatted data: | |
| 294 294 | 
             
            ```ruby
         | 
| 295 295 | 
             
            renderer.render
         | 
| 296 296 | 
             
            # =>
         | 
| 297 | 
            -
              +-------+-------+
         | 
| 298 | 
            -
              |header1|header2|
         | 
| 299 | 
            -
              +-------+-------+
         | 
| 300 | 
            -
              |a1     |a2     |
         | 
| 301 | 
            -
              |b1     |b2     |
         | 
| 302 | 
            -
              +-------+-------+
         | 
| 297 | 
            +
            #  +-------+-------+
         | 
| 298 | 
            +
            #  |header1|header2|
         | 
| 299 | 
            +
            #  +-------+-------+
         | 
| 300 | 
            +
            #  |a1     |a2     |
         | 
| 301 | 
            +
            #  |b1     |b2     |
         | 
| 302 | 
            +
            #  +-------+-------+
         | 
| 303 303 | 
             
            ```
         | 
| 304 304 |  | 
| 305 305 | 
             
            This is the same as calling `render` directly on table instance with `:ascii` as the first argument:
         | 
| @@ -323,12 +323,12 @@ and then call `render` to get the formatted data: | |
| 323 323 | 
             
            ```ruby
         | 
| 324 324 | 
             
            renderer.render
         | 
| 325 325 | 
             
            # =>
         | 
| 326 | 
            -
              ┌───────┬───────┐
         | 
| 327 | 
            -
              │header1│header2│
         | 
| 328 | 
            -
              ├───────┼───────┤
         | 
| 329 | 
            -
              │a1     │a2     │
         | 
| 330 | 
            -
              │b1     │b2     │
         | 
| 331 | 
            -
              └───────┴───────┘
         | 
| 326 | 
            +
            #  ┌───────┬───────┐
         | 
| 327 | 
            +
            #  │header1│header2│
         | 
| 328 | 
            +
            #  ├───────┼───────┤
         | 
| 329 | 
            +
            #  │a1     │a2     │
         | 
| 330 | 
            +
            #  │b1     │b2     │
         | 
| 331 | 
            +
            #  └───────┴───────┘
         | 
| 332 332 | 
             
            ```
         | 
| 333 333 |  | 
| 334 334 | 
             
            This is the same as calling `render` directly on table instance with `:unicode` as the first argument:
         | 
| @@ -384,12 +384,12 @@ You can align each column individuall by passing `alignments` option to table re | |
| 384 384 | 
             
            ```ruby
         | 
| 385 385 | 
             
            table.render :ascii, alignments: [:center, :right]
         | 
| 386 386 | 
             
            # =>
         | 
| 387 | 
            -
              +-------+-------+
         | 
| 388 | 
            -
              |header1|header2|
         | 
| 389 | 
            -
              +-------+-------+
         | 
| 390 | 
            -
              |  a1   |     a2|
         | 
| 391 | 
            -
              |  b1   |     b2|
         | 
| 392 | 
            -
              +-------+-------+
         | 
| 387 | 
            +
            #  +-------+-------+
         | 
| 388 | 
            +
            #  |header1|header2|
         | 
| 389 | 
            +
            #  +-------+-------+
         | 
| 390 | 
            +
            #  |  a1   |     a2|
         | 
| 391 | 
            +
            #  |  b1   |     b2|
         | 
| 392 | 
            +
            #  +-------+-------+
         | 
| 393 393 | 
             
            ```
         | 
| 394 394 |  | 
| 395 395 | 
             
            Alternatively you can align all columns with `alignment` option:
         | 
| @@ -397,12 +397,12 @@ Alternatively you can align all columns with `alignment` option: | |
| 397 397 | 
             
            ```ruby
         | 
| 398 398 | 
             
            table.render :ascii, alignment: [:center]
         | 
| 399 399 | 
             
            # =>
         | 
| 400 | 
            -
              +-------+-------+
         | 
| 401 | 
            -
              |header1|header2|
         | 
| 402 | 
            -
              +-------+-------+
         | 
| 403 | 
            -
              |  a1   |  a2   |
         | 
| 404 | 
            -
              |  b1   |  b2   |
         | 
| 405 | 
            -
              +-------+-------+
         | 
| 400 | 
            +
            #  +-------+-------+
         | 
| 401 | 
            +
            #  |header1|header2|
         | 
| 402 | 
            +
            #  +-------+-------+
         | 
| 403 | 
            +
            #  |  a1   |  a2   |
         | 
| 404 | 
            +
            #  |  b1   |  b2   |
         | 
| 405 | 
            +
            #  +-------+-------+
         | 
| 406 406 | 
             
            ```
         | 
| 407 407 |  | 
| 408 408 | 
             
            If you require a more granular alignment you can align individual fields in a row by passing `:alignment` option like so:
         | 
| @@ -418,12 +418,12 @@ and then simply render: | |
| 418 418 | 
             
            ```ruby
         | 
| 419 419 | 
             
            table.render(:ascii)
         | 
| 420 420 | 
             
            # =>
         | 
| 421 | 
            -
              +-------+-------+
         | 
| 422 | 
            -
              |header1|header2|
         | 
| 423 | 
            -
              +-------+-------+
         | 
| 424 | 
            -
              |     a1|a2     |
         | 
| 425 | 
            -
              |b1     |  b2   |
         | 
| 426 | 
            -
              +-------+-------+
         | 
| 421 | 
            +
            #  +-------+-------+
         | 
| 422 | 
            +
            #  |header1|header2|
         | 
| 423 | 
            +
            #  +-------+-------+
         | 
| 424 | 
            +
            #  |     a1|a2     |
         | 
| 425 | 
            +
            #  |b1     |  b2   |
         | 
| 426 | 
            +
            #  +-------+-------+
         | 
| 427 427 | 
             
            ```
         | 
| 428 428 |  | 
| 429 429 | 
             
            ### 3.5 Border
         | 
| @@ -434,12 +434,12 @@ To print border around data table you need to specify `renderer` type out of `ba | |
| 434 434 | 
             
            table = TTY::Table.new ['header1', 'header2'], [['a1', 'a2'], ['b1', 'b2']
         | 
| 435 435 | 
             
            table.render :unicode
         | 
| 436 436 | 
             
            # =>
         | 
| 437 | 
            -
              ┌───────┬───────┐
         | 
| 438 | 
            -
              │header1│header2│
         | 
| 439 | 
            -
              ├───────┼───────┤
         | 
| 440 | 
            -
              │a1     │a2     │
         | 
| 441 | 
            -
              │b1     │b2     │
         | 
| 442 | 
            -
              └───────┴───────┘
         | 
| 437 | 
            +
            #  ┌───────┬───────┐
         | 
| 438 | 
            +
            #  │header1│header2│
         | 
| 439 | 
            +
            #  ├───────┼───────┤
         | 
| 440 | 
            +
            #  │a1     │a2     │
         | 
| 441 | 
            +
            #  │b1     │b2     │
         | 
| 442 | 
            +
            #  └───────┴───────┘
         | 
| 443 443 | 
             
            ```
         | 
| 444 444 |  | 
| 445 445 | 
             
            or by creating unicode renderer:
         | 
| @@ -482,10 +482,10 @@ table.render do |renderer| | |
| 482 482 | 
             
              end
         | 
| 483 483 | 
             
            end
         | 
| 484 484 | 
             
            # =>
         | 
| 485 | 
            -
              header1 header2
         | 
| 486 | 
            -
              ======= =======
         | 
| 487 | 
            -
              a1      a2
         | 
| 488 | 
            -
              b1      b2
         | 
| 485 | 
            +
            #  header1 header2
         | 
| 486 | 
            +
            #  ======= =======
         | 
| 487 | 
            +
            #  a1      a2
         | 
| 488 | 
            +
            #  b1      b2
         | 
| 489 489 | 
             
            ```
         | 
| 490 490 |  | 
| 491 491 | 
             
            #### 3.5.2 Custom
         | 
| @@ -512,9 +512,9 @@ Next pass the border class to your table instance `render_with` method | |
| 512 512 | 
             
            table = TTY::Table.new ['header1', 'header2'], [['a1', 'a2'], ['b1', 'b2']
         | 
| 513 513 | 
             
            table.render_with MyBorder
         | 
| 514 514 | 
             
            # =>
         | 
| 515 | 
            -
              $header1$header2$
         | 
| 516 | 
            -
              $a1     $a2     $
         | 
| 517 | 
            -
              *       *       *
         | 
| 515 | 
            +
            #  $header1$header2$
         | 
| 516 | 
            +
            #  $a1     $a2     $
         | 
| 517 | 
            +
            #  *       *       *
         | 
| 518 518 | 
             
            ```
         | 
| 519 519 |  | 
| 520 520 | 
             
            #### 3.5.3 Separator
         | 
| @@ -527,13 +527,13 @@ table.render do |renderer| | |
| 527 527 | 
             
              renderer.border.separator = :each_row
         | 
| 528 528 | 
             
            end
         | 
| 529 529 | 
             
            # =>
         | 
| 530 | 
            -
              +-------+-------+
         | 
| 531 | 
            -
              |header1|header2|
         | 
| 532 | 
            -
              +-------+-------+
         | 
| 533 | 
            -
              |a1     |a2     |
         | 
| 534 | 
            -
              +-------+-------+
         | 
| 535 | 
            -
              |b1     |b2     |
         | 
| 536 | 
            -
              +-------+-------+
         | 
| 530 | 
            +
            #  +-------+-------+
         | 
| 531 | 
            +
            #  |header1|header2|
         | 
| 532 | 
            +
            #  +-------+-------+
         | 
| 533 | 
            +
            #  |a1     |a2     |
         | 
| 534 | 
            +
            #  +-------+-------+
         | 
| 535 | 
            +
            #  |b1     |b2     |
         | 
| 536 | 
            +
            #  +-------+-------+
         | 
| 537 537 | 
             
            ```
         | 
| 538 538 |  | 
| 539 539 | 
             
            #### 3.5.4 Style
         | 
| @@ -564,13 +564,13 @@ table.render do |renderer| | |
| 564 564 | 
             
              end
         | 
| 565 565 | 
             
            end
         | 
| 566 566 | 
             
            # =>
         | 
| 567 | 
            -
              +-------+-------+
         | 
| 568 | 
            -
              |header1|header2|
         | 
| 569 | 
            -
              +-------+-------+
         | 
| 570 | 
            -
              |a1     |A2     |
         | 
| 571 | 
            -
              +-------+-------+
         | 
| 572 | 
            -
              |b1     |B2     |
         | 
| 573 | 
            -
              +-------+-------+
         | 
| 567 | 
            +
            #  +-------+-------+
         | 
| 568 | 
            +
            #  |header1|header2|
         | 
| 569 | 
            +
            #  +-------+-------+
         | 
| 570 | 
            +
            #  |a1     |A2     |
         | 
| 571 | 
            +
            #  +-------+-------+
         | 
| 572 | 
            +
            #  |b1     |B2     |
         | 
| 573 | 
            +
            #  +-------+-------+
         | 
| 574 574 | 
             
            ```
         | 
| 575 575 |  | 
| 576 576 | 
             
            To color even fields red on green background add filter like so
         | 
| @@ -593,13 +593,13 @@ Renderer options may include `multiline` parameter. When set to `true`, table fi | |
| 593 593 | 
             
            table = TTY::Table.new [ ["First", '1'], ["Multi\nLine\nContent", '2'], ["Third", '3']]
         | 
| 594 594 | 
             
            table.render :ascii, multiline: true
         | 
| 595 595 | 
             
            # =>
         | 
| 596 | 
            -
              +-------+-+
         | 
| 597 | 
            -
              |First  |1|
         | 
| 598 | 
            -
              |Multi  |2|
         | 
| 599 | 
            -
              |Line   | |
         | 
| 600 | 
            -
              |Content| |
         | 
| 601 | 
            -
              |Third  |3|
         | 
| 602 | 
            -
              +-------+-+
         | 
| 596 | 
            +
            #  +-------+-+
         | 
| 597 | 
            +
            #  |First  |1|
         | 
| 598 | 
            +
            #  |Multi  |2|
         | 
| 599 | 
            +
            #  |Line   | |
         | 
| 600 | 
            +
            #  |Content| |
         | 
| 601 | 
            +
            #  |Third  |3|
         | 
| 602 | 
            +
            #  +-------+-+
         | 
| 603 603 | 
             
            ```
         | 
| 604 604 |  | 
| 605 605 | 
             
            When `multiline` is set to `false`, all line break characters will be escaped. In cases when the column widths are set, the content will be truncated.
         | 
| @@ -608,11 +608,11 @@ When `multiline` is set to `false`, all line break characters will be escaped. I | |
| 608 608 | 
             
            table = TTY::Table.new [["First", '1'], ["Multiline\nContent", '2'], ["Third", '3']]
         | 
| 609 609 | 
             
            table.render :ascii, multiline: false
         | 
| 610 610 | 
             
            # =>
         | 
| 611 | 
            -
              +------------------+-+
         | 
| 612 | 
            -
              |First             |1|
         | 
| 613 | 
            -
              |Multiline\nContent|2|
         | 
| 614 | 
            -
              |Third             |3|
         | 
| 615 | 
            -
              +------------------+-+
         | 
| 611 | 
            +
            #  +------------------+-+
         | 
| 612 | 
            +
            #  |First             |1|
         | 
| 613 | 
            +
            #  |Multiline\nContent|2|
         | 
| 614 | 
            +
            #  |Third             |3|
         | 
| 615 | 
            +
            #  +------------------+-+
         | 
| 616 616 | 
             
            ```
         | 
| 617 617 |  | 
| 618 618 | 
             
            ### 3.8 Padding
         | 
| @@ -630,18 +630,18 @@ Therefore, to apply padding to the example table do: | |
| 630 630 | 
             
            ```ruby
         | 
| 631 631 | 
             
            table.render(:ascii, padding: [1,2,1,2])
         | 
| 632 632 | 
             
            # =>
         | 
| 633 | 
            -
              +---------+---------+
         | 
| 634 | 
            -
              |         |         |
         | 
| 635 | 
            -
              | header1 | header2 |
         | 
| 636 | 
            -
              |         |         |
         | 
| 637 | 
            -
              +---------+---------+
         | 
| 638 | 
            -
              |         |         |
         | 
| 639 | 
            -
              | a1      | a2      |
         | 
| 640 | 
            -
              |         |         |
         | 
| 641 | 
            -
              |         |         |
         | 
| 642 | 
            -
              | b1      | b2      |
         | 
| 643 | 
            -
              |         |         |
         | 
| 644 | 
            -
              +---------+---------+
         | 
| 633 | 
            +
            #  +---------+---------+
         | 
| 634 | 
            +
            #  |         |         |
         | 
| 635 | 
            +
            #  | header1 | header2 |
         | 
| 636 | 
            +
            #  |         |         |
         | 
| 637 | 
            +
            #  +---------+---------+
         | 
| 638 | 
            +
            #  |         |         |
         | 
| 639 | 
            +
            #  | a1      | a2      |
         | 
| 640 | 
            +
            #  |         |         |
         | 
| 641 | 
            +
            #  |         |         |
         | 
| 642 | 
            +
            #  | b1      | b2      |
         | 
| 643 | 
            +
            #  |         |         |
         | 
| 644 | 
            +
            #  +---------+---------+
         | 
| 645 645 | 
             
            ```
         | 
| 646 646 |  | 
| 647 647 | 
             
            However, when adding top or bottom padding to content with line breaks, the `multiline` option needs to be set to `true` to allow for rows to span multiple lines. For example:
         | 
| @@ -657,22 +657,22 @@ would render as: | |
| 657 657 | 
             
            ```ruby
         | 
| 658 658 | 
             
            table.render :ascii, multiline: true, padding: [1,2,1,2]
         | 
| 659 659 | 
             
            # =>
         | 
| 660 | 
            -
              +---------+----------+
         | 
| 661 | 
            -
              |         |          |
         | 
| 662 | 
            -
              |  h1     |  head2   |
         | 
| 663 | 
            -
              |         |          |
         | 
| 664 | 
            -
              +---------+----------+
         | 
| 665 | 
            -
              |         |          |
         | 
| 666 | 
            -
              |  Multi  |  Text    |
         | 
| 667 | 
            -
              |  Line   |  that    |
         | 
| 668 | 
            -
              |         |  wraps   |
         | 
| 669 | 
            -
              |         |          |
         | 
| 670 | 
            -
              |         |          |
         | 
| 671 | 
            -
              |  Some   |  Simple  |
         | 
| 672 | 
            -
              |  other  |          |
         | 
| 673 | 
            -
              |  text   |          |
         | 
| 674 | 
            -
              |         |          |
         | 
| 675 | 
            -
              +---------+----------+
         | 
| 660 | 
            +
            #  +---------+----------+
         | 
| 661 | 
            +
            #  |         |          |
         | 
| 662 | 
            +
            #  |  h1     |  head2   |
         | 
| 663 | 
            +
            #  |         |          |
         | 
| 664 | 
            +
            #  +---------+----------+
         | 
| 665 | 
            +
            #  |         |          |
         | 
| 666 | 
            +
            #  |  Multi  |  Text    |
         | 
| 667 | 
            +
            #  |  Line   |  that    |
         | 
| 668 | 
            +
            #  |         |  wraps   |
         | 
| 669 | 
            +
            #  |         |          |
         | 
| 670 | 
            +
            #  |         |          |
         | 
| 671 | 
            +
            #  |  Some   |  Simple  |
         | 
| 672 | 
            +
            #  |  other  |          |
         | 
| 673 | 
            +
            #  |  text   |          |
         | 
| 674 | 
            +
            #  |         |          |
         | 
| 675 | 
            +
            #  +---------+----------+
         | 
| 676 676 | 
             
            ```
         | 
| 677 677 |  | 
| 678 678 | 
             
            ### 3.9 Resize
         | 
| @@ -689,12 +689,12 @@ rows   = [['aaa1', 'aa2', 'aaaaaaa3'], ['b1', 'b2', 'b3']] | |
| 689 689 | 
             
            table = TTY::Table.new header, rows
         | 
| 690 690 | 
             
            table.render width: 80, resize: true
         | 
| 691 691 | 
             
            # =>
         | 
| 692 | 
            -
              +---------+-------+------------+
         | 
| 693 | 
            -
              |h1       |h2     |h3          |
         | 
| 694 | 
            -
              +---------+-------+------------+
         | 
| 695 | 
            -
              |aaa1     |aa2    |aaaaaaa3    |
         | 
| 696 | 
            -
              |b1       |b2     |b3          |
         | 
| 697 | 
            -
              +---------+-------+------------+
         | 
| 692 | 
            +
            #  +---------+-------+------------+
         | 
| 693 | 
            +
            #  |h1       |h2     |h3          |
         | 
| 694 | 
            +
            #  +---------+-------+------------+
         | 
| 695 | 
            +
            #  |aaa1     |aa2    |aaaaaaa3    |
         | 
| 696 | 
            +
            #  |b1       |b2     |b3          |
         | 
| 697 | 
            +
            #  +---------+-------+------------+
         | 
| 698 698 | 
             
            ```
         | 
| 699 699 |  | 
| 700 700 | 
             
            ## Contributing
         | 
| @@ -705,6 +705,8 @@ table.render width: 80, resize: true | |
| 705 705 | 
             
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 706 706 | 
             
            5. Create a new Pull Request
         | 
| 707 707 |  | 
| 708 | 
            +
            This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
         | 
| 709 | 
            +
             | 
| 708 710 | 
             
            ## Copyright
         | 
| 709 711 |  | 
| 710 | 
            -
            Copyright (c) 2015- | 
| 712 | 
            +
            Copyright (c) 2015-2017 Piotr Murach. See LICENSE for further details.
         | 
    
        data/lib/tty-table.rb
    CHANGED
    
    | @@ -1,48 +1,5 @@ | |
| 1 | 
            -
            #  | 
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 2 |  | 
| 3 | 
            -
            require 'equatable'
         | 
| 4 | 
            -
            require 'forwardable'
         | 
| 5 | 
            -
            require 'necromancer'
         | 
| 6 | 
            -
            require 'verse'
         | 
| 7 | 
            -
            require 'tty-screen'
         | 
| 8 | 
            -
            require 'pastel'
         | 
| 9 | 
            -
            require 'unicode/display_width'
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            require 'tty/table/header'
         | 
| 12 | 
            -
            require 'tty/table/row'
         | 
| 13 | 
            -
            require 'tty/table/field'
         | 
| 14 | 
            -
            require 'tty/table/version'
         | 
| 15 | 
            -
            require 'tty/table/validatable'
         | 
| 16 3 | 
             
            require 'tty/table/error'
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            require 'tty/table/border'
         | 
| 19 | 
            -
            require 'tty/table/border_dsl'
         | 
| 20 | 
            -
            require 'tty/table/border_options'
         | 
| 21 | 
            -
            require 'tty/table/border/unicode'
         | 
| 22 | 
            -
            require 'tty/table/border/ascii'
         | 
| 23 | 
            -
            require 'tty/table/border/null'
         | 
| 24 | 
            -
            require 'tty/table/border/row_line'
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            require 'tty/table/renderer/basic'
         | 
| 27 | 
            -
            require 'tty/table/renderer/ascii'
         | 
| 28 | 
            -
            require 'tty/table/renderer/unicode'
         | 
| 29 | 
            -
            require 'tty/table/renderer'
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            require 'tty/table/alignment_set'
         | 
| 32 | 
            -
            require 'tty/table/column_set'
         | 
| 33 | 
            -
            require 'tty/table/column_constraint'
         | 
| 34 | 
            -
            require 'tty/table/orientation'
         | 
| 35 | 
            -
            require 'tty/table/orientation/horizontal'
         | 
| 36 | 
            -
            require 'tty/table/orientation/vertical'
         | 
| 37 | 
            -
            require 'tty/table/transformation'
         | 
| 38 | 
            -
            require 'tty/table/indentation'
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            require 'tty/table/operations'
         | 
| 41 | 
            -
            require 'tty/table/operation/alignment'
         | 
| 42 | 
            -
            require 'tty/table/operation/truncation'
         | 
| 43 | 
            -
            require 'tty/table/operation/wrapped'
         | 
| 44 | 
            -
            require 'tty/table/operation/filter'
         | 
| 45 | 
            -
            require 'tty/table/operation/escape'
         | 
| 46 | 
            -
            require 'tty/table/operation/padding'
         | 
| 47 | 
            -
             | 
| 4 | 
            +
            require 'tty/table/version'
         | 
| 48 5 | 
             
            require 'tty/table'
         | 
    
        data/lib/tty/table.rb
    CHANGED
    
    | @@ -1,5 +1,17 @@ | |
| 1 1 | 
             
            # coding: utf-8
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'equatable'
         | 
| 4 | 
            +
            require 'forwardable'
         | 
| 5 | 
            +
            require 'necromancer'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            require 'tty/table/column_set'
         | 
| 8 | 
            +
            require 'tty/table/header'
         | 
| 9 | 
            +
            require 'tty/table/orientation'
         | 
| 10 | 
            +
            require 'tty/table/row'
         | 
| 11 | 
            +
            require 'tty/table/renderer'
         | 
| 12 | 
            +
            require 'tty/table/transformation'
         | 
| 13 | 
            +
            require 'tty/table/validatable'
         | 
| 14 | 
            +
             | 
| 3 15 | 
             
            module TTY
         | 
| 4 16 | 
             
              # A core class intended for storing data in a structured, tabular form.
         | 
| 5 17 | 
             
              # Once the data is stored in a TTY::Table various operations can be performed
         | 
    
        data/lib/tty/table/border.rb
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'equatable'
         | 
| 4 | 
            +
            require 'pastel'
         | 
| 5 | 
            +
            require 'verse'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            require 'tty/table/border_options'
         | 
| 8 | 
            +
            require 'tty/table/border_dsl'
         | 
| 9 | 
            +
            require 'tty/table/border/row_line'
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            module TTY
         | 
| 4 12 | 
             
              class Table
         | 
| 5 13 | 
             
                # Abstract base class that is responsible for building the table border.
         | 
    
        data/lib/tty/table/border_dsl.rb
    CHANGED
    
    
    
        data/lib/tty/table/column_set.rb
    CHANGED
    
    
    
        data/lib/tty/table/field.rb
    CHANGED
    
    
    
        data/lib/tty/table/header.rb
    CHANGED
    
    
    
        data/lib/tty/table/renderer.rb
    CHANGED
    
    
| @@ -1,5 +1,25 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'tty-screen'
         | 
| 4 | 
            +
            require 'verse'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            require 'tty/table/alignment_set'
         | 
| 7 | 
            +
            require 'tty/table/border_dsl'
         | 
| 8 | 
            +
            require 'tty/table/border_options'
         | 
| 9 | 
            +
            require 'tty/table/border/null'
         | 
| 10 | 
            +
            require 'tty/table/column_constraint'
         | 
| 11 | 
            +
            require 'tty/table/column_set'
         | 
| 12 | 
            +
            require 'tty/table/header'
         | 
| 13 | 
            +
            require 'tty/table/indentation'
         | 
| 14 | 
            +
            require 'tty/table/operations'
         | 
| 15 | 
            +
            require 'tty/table/operation/alignment'
         | 
| 16 | 
            +
            require 'tty/table/operation/truncation'
         | 
| 17 | 
            +
            require 'tty/table/operation/wrapped'
         | 
| 18 | 
            +
            require 'tty/table/operation/filter'
         | 
| 19 | 
            +
            require 'tty/table/operation/escape'
         | 
| 20 | 
            +
            require 'tty/table/operation/padding'
         | 
| 21 | 
            +
            require 'tty/table/validatable'
         | 
| 22 | 
            +
             | 
| 3 23 | 
             
            module TTY
         | 
| 4 24 | 
             
              class Table
         | 
| 5 25 | 
             
                class Renderer
         | 
    
        data/lib/tty/table/row.rb
    CHANGED
    
    
    
        data/lib/tty/table/version.rb
    CHANGED
    
    
    
        data/tty-table.gemspec
    CHANGED
    
    | @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| | |
| 20 20 |  | 
| 21 21 | 
             
              spec.add_dependency 'equatable',   '~> 0.5.0'
         | 
| 22 22 | 
             
              spec.add_dependency 'necromancer', '~> 0.3.0'
         | 
| 23 | 
            -
              spec.add_dependency 'pastel',      '~> 0. | 
| 23 | 
            +
              spec.add_dependency 'pastel',      '~> 0.7.0'
         | 
| 24 24 | 
             
              spec.add_dependency 'tty-screen',  '~> 0.5.0'
         | 
| 25 25 | 
             
              spec.add_dependency 'verse',       '~> 0.5.0'
         | 
| 26 26 | 
             
              spec.add_dependency 'unicode-display_width','~> 1.1.0'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: tty-table
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.7.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Piotr Murach
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-01-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: equatable
         | 
| @@ -44,14 +44,14 @@ dependencies: | |
| 44 44 | 
             
                requirements:
         | 
| 45 45 | 
             
                - - "~>"
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: 0. | 
| 47 | 
            +
                    version: 0.7.0
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: 0. | 
| 54 | 
            +
                    version: 0.7.0
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: tty-screen
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -139,6 +139,7 @@ files: | |
| 139 139 | 
             
            - ".rspec"
         | 
| 140 140 | 
             
            - ".travis.yml"
         | 
| 141 141 | 
             
            - CHANGELOG.md
         | 
| 142 | 
            +
            - CODE_OF_CONDUCT.md
         | 
| 142 143 | 
             
            - Gemfile
         | 
| 143 144 | 
             
            - LICENSE.txt
         | 
| 144 145 | 
             
            - README.md
         |