{"id":13750675,"url":"https://github.com/katzer/mruby-terminal-table","last_synced_at":"2026-03-11T13:13:50.752Z","repository":{"id":138109091,"uuid":"81219329","full_name":"katzer/mruby-terminal-table","owner":"katzer","description":"mruby table generator","archived":false,"fork":false,"pushed_at":"2022-07-05T07:51:10.000Z","size":44,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-02-14T02:05:54.441Z","etag":null,"topics":["mruby-gem","table-generator","terminal","tty"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katzer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-07T14:52:33.000Z","updated_at":"2022-07-05T07:36:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"6f73a0bc-8473-48fa-9908-84b766489cd1","html_url":"https://github.com/katzer/mruby-terminal-table","commit_stats":null,"previous_names":["appplant/mruby-terminal-table"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/katzer/mruby-terminal-table","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fmruby-terminal-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fmruby-terminal-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fmruby-terminal-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fmruby-terminal-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katzer","download_url":"https://codeload.github.com/katzer/mruby-terminal-table/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fmruby-terminal-table/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mruby-gem","table-generator","terminal","tty"],"created_at":"2024-08-03T08:00:44.083Z","updated_at":"2026-03-11T13:13:50.720Z","avatar_url":"https://github.com/katzer.png","language":"Ruby","readme":"# mruby-terminal-table \u003cbr\u003e [![Build Status](https://travis-ci.com/katzer/mruby-terminal-table.svg?branch=master)](https://travis-ci.com/katzer/mruby-terminal-table)\n\nA fast and simple, yet feature rich ASCII table generator for mruby based on [terminal-table][terminal-table].\n\n## Installation\n\nAdd the line below to your `build_config.rb`:\n\n```ruby\nMRuby::Build.new do |conf|\n  # ... (snip) ...\n  conf.gem 'mruby-terminal-table'\nend\n```\n\nOr add this line to your aplication's `mrbgem.rake`:\n\n```ruby\nMRuby::Gem::Specification.new('your-mrbgem') do |spec|\n  # ... (snap) ...\n  spec.add_dependency 'mruby-terminal-table'\nend\n```\n\n## Usage\n\nTo generate a table, provide an array of rows:\n\n```ruby\nrows  = [ ['One', 1], ['Two', 2], ['Three', 3] ]\n\ntable = Terminal::Table.new rows: rows\n\n# \u003e puts table\n#\n# +-------+---+\n# | One   | 1 |\n# | Two   | 2 |\n# | Three | 3 |\n# +-------+---+\n```\n\nThe constructor can also be given a block which is either yielded the Table object or instance evaluated:\n\n```ruby\ntable = Terminal::Table.new do |t|\n  t.rows = rows\nend\n\ntable = Terminal::Table.new do\n  self.rows = rows\nend\n```\n\nAdding rows one by one:\n\n```ruby\ntable = Terminal::Table.new do |t|\n  t \u003c\u003c ['One', 1]\n  t.add_row ['Two', 2]\nend\n```\n\nTo add separators between rows:\n\n```ruby\ntable = Terminal::Table.new do |t|\n  t \u003c\u003c ['One', 1]\n  t \u003c\u003c :separator\n  t.add_row ['Two', 2]\n  t.add_separator\n  t.add_row ['Three', 3]\nend\n\n# \u003e puts table\n#\n# +-------+---+\n# | One   | 1 |\n# +-------+---+\n# | Two   | 2 |\n# +-------+---+\n# | Three | 3 |\n# +-------+---+\n```\n\nCells can handle multiline content:\n\n```ruby\ntable = Terminal::Table.new do |t|\n  t \u003c\u003c ['One', 1]\n  t \u003c\u003c :separator\n  t.add_row [\"Two\\nDouble\", 2]\n  t.add_separator\n  t.add_row ['Three', 3]\nend\n\n# \u003e puts table\n#\n# +--------+---+\n# | One    | 1 |\n# +--------+---+\n# | Two    | 2 |\n# | Double |   |\n# +--------+---+\n# | Three  | 3 |\n# +--------+---+\n```\n\n### Headings\n\nTo add a head to the table:\n\n```ruby\ntable = Terminal::Table.new headings: %w(Word Number), rows: rows\n\n# \u003e puts table\n#\n# +-------+--------+\n# | Word  | Number |\n# +-------+--------+\n# | One   | 1      |\n# | Two   | 2      |\n# | Three | 3      |\n# +-------+--------+\n```\n\nTo add a title to the table:\n\n```ruby\ntable = Terminal::Table.new title: 'Cheatsheet', headings: %w(Word Number), rows: rows\n\n# \u003e puts table\n#\n# +------------+--------+\n# |     Cheatsheet      |\n# +------------+--------+\n# | Word       | Number |\n# +------------+--------+\n# | One        | 1      |\n# | Two        | 2      |\n# | Three      | 3      |\n# +------------+--------+\n```\n\n### Alignment\n\nTo align the second column to the right:\n\n```ruby\ntable.align_column 1, :right\n\n# \u003e puts table\n#\n# +-------+--------+\n# | Word  | Number |\n# +-------+--------+\n# | One   |      1 |\n# | Two   |      2 |\n# | Three |      3 |\n# +-------+--------+\n```\n\nTo align an individual cell, you specify the cell value in a hash along the alignment:\n\n```ruby\ntable \u003c\u003c ['Four', value: 4.0, alignment: :center]\n\n# \u003e puts table\n#\n# +-------+--------+\n# | Word  | Number |\n# +-------+--------+\n# | One   |      1 |\n# | Two   |      2 |\n# | Three |      3 |\n# | Four  |  4.0   |\n# +-------+--------+\n```\n\n### Custom styles\n\nTo specify style options:\n\n```ruby\ntable = Terminal::Table.new headings: %w(Word Number), rows: rows, style: { width: 80 }\n\n# \u003e puts table\n#\n# +--------------------------------------+---------------------------------------+\n# | Word                                 | Number                                |\n# +--------------------------------------+---------------------------------------+\n# | One                                  | 1                                     |\n# | Two                                  | 2                                     |\n# | Three                                | 3                                     |\n# +--------------------------------------+---------------------------------------+\n```\n\nAnd change styles on the fly:\n\n```ruby\ntable.style = { width: 40, padding_left: 3, border_x: '=', border_i: 'x' }\n\n# \u003e puts table\n#\n# x====================x=================x\n# |               Cheatsheet             |\n# x====================x=================x\n# |   Word             |   Number        |\n# x====================x=================x\n# |   One              |   1             |\n# |   Two              |   2             |\n# |   Three            |   3             |\n# x====================x=================x\n```\n\nYou can also use styles to add a separator after every row:\n\n```ruby\ntable = Terminal::Table.new do |t|\n  t.add_row [1, 'One']\n  t.add_row [2, 'Two']\n  t.add_row [3, 'Three']\n  t.style = { all_separators: true }\nend\n\n# \u003e puts table\n#\n# +---+-------+\n# | 1 | One   |\n# +---+-------+\n# | 2 | Two   |\n# +---+-------+\n# | 3 | Three |\n# +---+-------+\n```\n\nTo change the default style options:\n\n```ruby\nTerminal::Table::Style.defaults = { width: 80 }\n```\n\nAll Table objects created afterwards will inherit these defaults.\n\n### Constructor and setters\n\nValid options for the constructor are `rows`, `headings`, `style` and `title` - and all options can also be set on the created table object by their setter method:\n\n```ruby\ntable = Terminal::Table.new\n\ntable.title    = 'Cheatsheet'\ntable.headings = %w(Word Number)\ntable.rows     = rows\ntable.style    = { width: 40 }\n```\n\n## Development\n\nClone the repo:\n    \n    $ git clone https://github.com/appplant/mruby-terminal-table.git \u0026\u0026 cd mruby-terminal-table/\n\nCompile the source:\n\n    $ rake compile\n\nRun the tests:\n\n    $ rake test\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/appplant/mruby-terminal-table.\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Authors\n\n- All contributors from the [terminal-table][terminal-table] gem.\n- Sebastián Katzer, Fa. appPlant GmbH\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License][license].\n\nMade with :yum: in Leipzig\n\n© 2017 [appPlant GmbH][appplant]\n\n[terminal-table]: https://github.com/tj/terminal-table\n[license]: http://opensource.org/licenses/MIT\n[appplant]: www.appplant.de\n","funding_links":[],"categories":["Text Processing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatzer%2Fmruby-terminal-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatzer%2Fmruby-terminal-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatzer%2Fmruby-terminal-table/lists"}