Class: Iguvium::Row
- Inherits:
-
Object
- Object
- Iguvium::Row
- Defined in:
- lib/iguvium/row.rb
Instance Method Summary collapse
- #cells ⇒ Object
-
#initialize(columns, characters, phrases: true) ⇒ Row
constructor
gets characters limited by yrange and set of column ranges.
- #merge(other) ⇒ Object
-
#render(newlines: false) ⇒ Object
Rendered row array.
Constructor Details
#initialize(columns, characters, phrases: true) ⇒ Row
gets characters limited by yrange and set of column ranges
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/iguvium/row.rb', line 7 def initialize(columns, characters, phrases: true) @columns = columns if phrases characters = characters .sort .chunk_while { |a, b| a.mergable?(b) } .map { |chunk| chunk.inject(:+) } end @characters = characters end |
Instance Method Details
#cells ⇒ Object
19 20 21 22 23 |
# File 'lib/iguvium/row.rb', line 19 def cells @columns.map { |range| @characters.select { |character| range.cover?(character.x) } } end |
#merge(other) ⇒ Object
29 30 |
# File 'lib/iguvium/row.rb', line 29 def merge(other) end |
#render(newlines: false) ⇒ Object
Returns rendered row array.
26 27 |
# File 'lib/iguvium/row.rb', line 26 def render(newlines: false) end |