Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in v1.8.0 - uninitialized constant Terminal::Table::Cell::Unicode (NameError) #103

Open
DannyBen opened this issue Dec 25, 2018 · 1 comment

Comments

@DannyBen
Copy link

I am getting an error with version 1.8.0, while version 1.7.3 does not seem to have the problem.
I never had this error before, perhaps I had version 1.7.3 installed before today.

Code

require 'terminal-table'

rows = []
rows << ['One', 1]
rows << ['Two', 2]
rows << ['Three', 3]
table = Terminal::Table.new rows: rows
puts table

Error

uninitialized constant Terminal::Table::Cell::Unicode (NameError)

Error Location

def value_for_column_width_recalc
lines.map{ |s| escape(s) }.max_by{ |s| Unicode::DisplayWidth.of(s) }
end

Backtrace

Traceback (most recent call last):
        19: from test.rb:8:in `<main>'
        18: from test.rb:8:in `puts'
        17: from test.rb:8:in `puts'
        16: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:142:in `render'
        15: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:142:in `map'
        14: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:142:in `block in render'
        13: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb:6:in `render'
        12: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb:6:in `map'
        11: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/separator.rb:7:in `block in render'
        10: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:97:in `column_width'
         9: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:339:in `column_widths'
         8: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:201:in `recalc_column_widths'
         7: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:201:in `each'
         6: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:203:in `block in recalc_column_widths'
         5: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:203:in `each'
         4: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/table.rb:204:in `block (2 levels) in recalc_column_widths'
         3: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb:71:in `value_for_column_width_recalc'
         2: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb:71:in `max_by'
         1: from /store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb:71:in `each'
/store/gems/ruby-2.5.0/gems/terminal-table-1.8.0/lib/terminal-table/cell.rb:71:in `block in value_for_column_width_recalc': uninitialized constant Terminal::Table::Cell::Unicode (NameError)

System info

Ruby: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
RVM: rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Bundler: Bundler version 1.17.2
OS: Ubuntu 16.04.5 LTS

@nanobowers
Copy link
Contributor

@DannyBen I think you need to install the unicode-display_width gem first. From the terminal-table.gemspec:

spec.add_runtime_dependency "unicode-display_width", ["~> 1.1", ">= 1.1.1"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants