Class: ColorLS::Layout
- Inherits:
-
Object
- Object
- ColorLS::Layout
- Defined in:
- lib/colorls/layout.rb
Direct Known Subclasses
Instance Method Summary collapse
- #each_line ⇒ Object
-
#initialize(contents, widths, line_size) ⇒ Layout
constructor
A new instance of Layout.
Constructor Details
#initialize(contents, widths, line_size) ⇒ Layout
Returns a new instance of Layout.
5 6 7 8 9 |
# File 'lib/colorls/layout.rb', line 5 def initialize(contents, widths, line_size) @max_widths = widths @contents = contents @screen_width = line_size end |
Instance Method Details
#each_line ⇒ Object
11 12 13 14 15 |
# File 'lib/colorls/layout.rb', line 11 def each_line return if @contents.empty? get_chunks(chunk_size).each { |line| yield(line.compact, @max_widths) } end |