table_print icon indicating copy to clipboard operation
table_print copied to clipboard

Width option does nothing half of the time.

Open snowe2010 opened this issue 10 years ago • 2 comments

If I use the width option like this

  tp $scen, {"features.name" => {display_name: "Features", width: 30}},
            {"features.scenarios.name" => {display_name: "Scenarios", :width => 50}},
            {"features.scenarios.time" => {display_name: "Time", width: 10}},
            {"features.scenarios.steps" => {display_name: "Steps", width: 10}},
            {"features.scenarios.tps" => {display_name: "TPS", width: 10}}

It does absolutely nothing unless the width is already less than whatever width it's already using. In other words it shows this for everything past 19, and only if I lower the width below that amount will it change the width.

FEATURES           | SCENARIOS                 | TIME   | STEPS | TPS
-------------------|---------------------------|--------|-------|-----------
Find Account Tests | No search results in erro | 16.392 | 6     | 2.73199...
                   | Field Search, Examples (# | 3.869  | 10    | 0.3869
                   | Field Search, Examples (# | 3.637  | 10    | 0.3637
                   | Field Search, Examples (# | 3.647  | 10    | 0.36469...
                   | Field Search, Examples (# | 3.537  | 10    | 0.3537
                   | Field Search, Examples (# | 3.647  | 10    | 0.36469...
                   | Field Search, Examples (# | 3.701  | 10    | 0.3701
                   | Field Search, Examples (# | 3.608  | 10    | 0.3608

On the same topic I cannot figure out how to make things group correctly. I'm not using active record and there are no examples of how to use this with a hash even though the Readme says it supports it. I've created custom classes and I've gotten closer, but I still don't understand at all how to use this gem without ActiveRecord.

snowe2010 avatar May 22 '15 21:05 snowe2010

@snowe2010 i've peeked through table_print's source, try fixed_width instead of width – seems to be working

Also, there is max_width global setting...

idrozd avatar Jun 28 '17 14:06 idrozd

@idrozd Thank you for the help, this was 2 years ago though, and I am at a completely different company now. I do not have access to the code I was using, so I cannot check that your solution works right now. If anyone else can verify that would be helpful to others I'm sure.

snowe2010 avatar Jul 07 '17 19:07 snowe2010