-
Notifications
You must be signed in to change notification settings - Fork 15
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
No aligns with ANSI characters (for colors) #6
Comments
The problem is, that require 'colorize'
module Text
class Table
class Cell
def initialize(options = {}) #:nodoc:
@value = options[:value].to_s
@row = options[:row]
@align = options[:align ] || :left
@colspan = options[:colspan] || 1
@color = options[:color] || :default
@background = options[:background] || :default
@effect = options[:effect] || :default
end
def set_color(string)
string.colorize color: @color, background: @background, mode: @effect
end
def to_s #:nodoc:
([' ' * table.horizontal_padding]*2).join case align
when :left
set_color(value.ljust cell_width)
when :right
set_color(value.rjust cell_width)
when :center
set_color(value.center cell_width)
end
end
end
end
end https://gist.github.com/ce7df9a788e945e83cae.git |
I'd like people to be able to do this using text-table but I haven't decided on the best way to do it. One of the things I've been thinking of is allowing a post_processor proc to be passed in like so:
In this example, I was also planning of rewriting everything except the specs. That's why I haven't gotten to resolving this issue. But that remains a plan. Pull requests are welcome though :-) |
No description provided.
The text was updated successfully, but these errors were encountered: