lib/ruby_jard/column.rb in ruby_jard-0.2.0 vs lib/ruby_jard/column.rb in ruby_jard-0.2.1
- old
+ new
@@ -1,18 +1,24 @@
# frozen_string_literal: true
module RubyJard
class Column
+ # Only break at breakable word
+ # | this_is_a <endline> |
+ # | really_long_content |
+ WORD_WRAP_NORMAL = :normal
+ # Break the word, and move the rest to the next line
+ # | this_is_a really_lon|
+ # | g_content |
+ WORD_WRAP_BREAK_WORD = :break_word
extend Forwardable
- attr_accessor :column_template, :spans, :content_length, :width
+ attr_accessor :spans, :content_length, :width, :word_wrap
- def_delegators :@column_template, :margin_left, :margin_right
-
- def initialize(column_template:)
- @column_template = column_template
- @spans = []
+ def initialize(spans: [], word_wrap: WORD_WRAP_NORMAL)
+ @spans = spans
@width = 0
@content_length = 0
+ @word_wrap = word_wrap
end
end
end