Giter Club home page Giter Club logo

Comments (6)

RylanBauermeister avatar RylanBauermeister commented on August 31, 2024

The README is wrong, but it works. You need to pass it:

renderer.border.separator = TTY::Table::Border::EACH_ROW

from tty-table.

MadBomber avatar MadBomber commented on August 31, 2024

I tryed that and got the same result...

>> puts table.render(:ascii) do |renderer|
 >       renderer.border.separator = :each_row
|    end  #=> nil
+-------+-------+
|header1|header2|
+-------+-------+
|a1     |a2     |
|b1     |b2     |
+-------+-------+
>> puts table.render(:ascii) do |renderer|
 >       renderer.border.separator = TTY::Table::Border::EACH_ROW
|    end  #=> nil
+-------+-------+
|header1|header2|
+-------+-------+
|a1     |a2     |
|b1     |b2     |
+-------+-------+

I am using Ruby 2.6.2. and tty-table (0.10.0.

This is the first time I've tried the gem since upgrading to Ruby 2.6.2. I ran into some gem conflicts with version 1.5.0 of unicode-display_width. I had to uninstall it an reinstall version 1.4.1 in order to get tty-table to load into my IRB session.

from tty-table.

piotrmurach avatar piotrmurach commented on August 31, 2024

This option works when the renderer class is used as evidenced in tests. I'm rather busy now preparing to speak at a conference next week. When I'm back I will try to find some time to look at some issues in this gem. Do you have anytime to submit PR that fixes this?

Re unicode-display_width which is used by strings dependency. I will upgrade soon to remove such strict versioning.

from tty-table.

RylanBauermeister avatar RylanBauermeister commented on August 31, 2024

@MadBomber The render method seems to have some interesting behavior with regards to what it returns--if you store the rendered table into a variable then put it, it works.

@piotrmurach I'm a student with a pretty busy schedule, but I'll see if I can find a little time to address this. It's certainly good experience for me to hunt things like this down!

rendered = table.render(:ascii) do |renderer|
    renderer.border.separator = TTY::Table::Border::EACH_ROW
end
puts rendered

from tty-table.

RylanBauermeister avatar RylanBauermeister commented on August 31, 2024

Okay, I've found some weirdness here. It looks like the issue isn't actually in the function, but in how it is called in conjunction with puts. The block executes fine as this:

puts table.render(:ascii) { |renderer|
    renderer.border.separator = :each_row
}

If you run it as a do/end block, it ignores the function aspect and just calls table.render(:ascii). This feels more like a problem with ruby's base puts function than with TTY-Table to me, but is certainly worth noting.

from tty-table.

piotrmurach avatar piotrmurach commented on August 31, 2024

@RylanBauermeister good find! I wasn't aware of this behaviour.

@MadBomber I've released new strings version which should fix the issue with unicode_display-width compatibilities. You should be able to install the latest version.

from tty-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.