Class: MonoclePrint::Vertical

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



41
42
43
44
45
# File 'lib/monocle-print/layout.rb', line 41

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

#renderObject



47
48
49
50
51
# File 'lib/monocle-print/layout.rb', line 47

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

#widthObject



37
38
39
# File 'lib/monocle-print/layout.rb', line 37

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