crystal_fmt
Version, currently 0.3.03 versions
- 0.3.1latestDec 20, 2017
- 0.3.0not indexedDec 4, 2018
- 0.2.0not indexedDec 4, 2018
github.com/masukomi/crystal_fmt
produces text tables from a grid of strings
Nothing has been indexed for 0.3.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
crystal_fmt:
github: masukomi/crystal_fmt
version: ~> 0.3.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.3.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Crystal Format (crystal_fmt)
Takes a grid of strings and produces a text table with custom borders, dividers, and header separator.
For example:
[["things", "stuff"],["a", "b"], ["c", nil]]
would be converted to...
| things | stuff |
| ------ | ----- |
| a | b |
| c | |
Inspired by the fmt egg for Chicken Scheme.
Installation
Add this to your application's shard.yml:
dependencies:
crystal_fmt:
github: masukomi/crystal_fmt
Usage
API Documentations is available here.
require "crystal_fmt"
# SIMPLE USAGE
table_data = Array(Array(String | Nil)).new
[["column 1", "column 2"], ["a", "b"], ["c", "d"]].each do |row|
table_data << row
end
t = Table.new(table_data)
t.format
# ^^^ produces
# | column 1 | column 2 |
# | -------- | -------- |
# | a | b |
# | c | d |
# CUSTOM DIVIDERS AND BORDERS
options = Hash(Symbol,String|Bool).new
options[:left_border] = "> "
options[:right_border] = " <"
options[:divider] = " . "
options[:header_divider] = "^"
t.format(options)
# Produces
# > column 1 . column 2 <
# > ^^^^^^^^ . ^^^^^^^^ <
# > a . b <
# > c . d <
Development
Before developing any feature please create an issue where you describe your idea.
Before working on a bug, please make sure there isn't already a GitHub Issue for it. If there is, make sure no-one's already working on it. If there isn't please create one.
If you have a useful sounding idea I'll probably want to merge it. If you've already coded up improvements for yourself, go ahead and file an Issue describing it and then make a PR.
Note: while I really want to add your contributions, no PR will be merged without passing unit tests.
Please ping me at @masukomi on Twitter so that I see your Issue promptly.
Contributing
- Fork it ( https://github.com/masukomi/crystal_fmt/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Please include unit tests and documentation.
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- Poke @masukomi on Twitter to make sure it gets seen promptly.
Contributors
- masukomi masukomi - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.3.0- Tagged
- Dec 4, 2018
- Commit
ed596774a365- Indexed
- not yet
Dependents
Repository
github.com/masukomi/crystal_fmt
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 3