Class: MonoclePrint::Horizontal

Inherits:
Layout
  • Object
show all
Defined in:
lib/monocle-print/layout.rb

Constant Summary

Constants included from Presentation

Presentation::ALIGNMENTS

Constants included from MonoclePrint

COLOR_ESCAPE, FOUR_BYTES, MULTIBYTE_CHARACTER, ONE_BYTE, THREE_BYTES, TWO_BYTES, VERSION

Instance Attribute Summary

Attributes included from Presentation

#max_width, #owner

Instance Method Summary collapse

Methods inherited from Layout

#initialize

Methods included from Presentation

#alignment, #alignment=, included, #output, #output=, #style, #style=, #to_s

Methods included from MonoclePrint

Line, Output, Rectangle, Style, Text, buffer, included, library_path, stderr, stdout, version

Constructor Details

This class inherits a constructor from MonoclePrint::Layout

Instance Method Details

#heightObject



23
24
25
# File 'lib/monocle-print/layout.rb', line 23

def height
  empty? ? 0 : collect { | view | view.height }.max
end

#renderObject



27
28
29
30
31
# File 'lib/monocle-print/layout.rb', line 27

def render
  map { | i | i.render }.inject do | out, text |
    out.juxtapose!( text )
  end
end

#widthObject



17
18
19
20
21
# File 'lib/monocle-print/layout.rb', line 17

def width
  inject( 0 ) do | width, view |
    width + view.width
  end
end