Comments (6)
The README is wrong, but it works. You need to pass it:
renderer.border.separator = TTY::Table::Border::EACH_ROW
from tty-table.
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.
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.
@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.
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.
@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)
- README Filter test code HOT 1
- Rotated table missing line separator HOT 3
- Dependency conflict with tty-prompt `necromancer` HOT 2
- Headless table fails HOT 1
- CSV/JSON/YAML renderers would be nice HOT 1
- How to disable rotating? HOT 1
- Create table directly from Hash HOT 4
- undefined method `rindex' for nil:NilClass when using resize: true HOT 7
- Multiline render option breaks multi coloured cell data HOT 4
- anyway to add a separator between arbitrary rows? HOT 2
- Dependency conflict on necromancer 0.4.0, tty-screen 0.6.4 HOT 1
- Strange separator inserting
- Please release version with pastel 0.8 dependency HOT 1
- Columns are not rendered when the table width exceeds the currently set width.Defaulting HOT 1
- table.render outputs nothing when used inside Thor HOT 1
- Support for column spanning HOT 2
- Wrong table header width when using TTY::Link
- How to force table to rotate vertically HOT 4
- Add Separator at position HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tty-table.