Class: ColorLS::Layout

Inherits:
Object
  • Object
show all
Defined in:
lib/colorls/layout.rb

Instance Method Summary collapse

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_lineObject



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