Class: MonoclePrint::Table::Segments
- Inherits:
-
Struct
- Object
- Struct
- MonoclePrint::Table::Segments
- Includes:
- MonoclePrint
- Defined in:
- lib/monocle-print/table/segments.rb,
lib/monocle-print/table/segments.rb
Constant Summary
Constants included from MonoclePrint
COLOR_ESCAPE, FOUR_BYTES, MULTIBYTE_CHARACTER, ONE_BYTE, MonoclePrint::THREE_BYTES, MonoclePrint::TWO_BYTES, VERSION
Instance Attribute Summary collapse
-
#foot ⇒ Object
Returns the value of attribute foot.
-
#head ⇒ Object
Returns the value of attribute head.
-
#row ⇒ Object
Returns the value of attribute row.
-
#row_divider ⇒ Object
Returns the value of attribute row_divider.
-
#section ⇒ Object
Returns the value of attribute section.
-
#section_close ⇒ Object
Returns the value of attribute section_close.
-
#section_open ⇒ Object
Returns the value of attribute section_open.
-
#title_divider ⇒ Object
Returns the value of attribute title_divider.
-
#title_row ⇒ Object
Returns the value of attribute title_row.
Class Method Summary collapse
- .default_filling(style) ⇒ Object
- .default_joints(style) ⇒ Object
- .default_left_edge(style) ⇒ Object
- .default_right_edge(style) ⇒ Object
Instance Method Summary collapse
Methods included from MonoclePrint
Line, Output, Rectangle, Style, Text, buffer, included, library_path, stderr, stdout, version
Instance Attribute Details
#foot ⇒ Object
Returns the value of attribute foot
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def foot @foot end |
#head ⇒ Object
Returns the value of attribute head
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def head @head end |
#row ⇒ Object
Returns the value of attribute row
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def row @row end |
#row_divider ⇒ Object
Returns the value of attribute row_divider
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def row_divider @row_divider end |
#section ⇒ Object
Returns the value of attribute section
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def section @section end |
#section_close ⇒ Object
Returns the value of attribute section_close
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def section_close @section_close end |
#section_open ⇒ Object
Returns the value of attribute section_open
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def section_open @section_open end |
#title_divider ⇒ Object
Returns the value of attribute title_divider
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def title_divider @title_divider end |
#title_row ⇒ Object
Returns the value of attribute title_row
7 8 9 |
# File 'lib/monocle-print/table/segments.rb', line 7 def title_row @title_row end |
Class Method Details
.default_filling(style) ⇒ Object
15 16 17 18 |
# File 'lib/monocle-print/table/segments.rb', line 15 def self.default_filling( style ) fill = style.new.dup new( fill, nil, fill, nil, fill, nil, fill, fill, fill ) end |
.default_joints(style) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/monocle-print/table/segments.rb', line 20 def self.default_joints( style ) head = style.format( "<h><hd><h>" ) row = style.format( " <v> " ) div = style.format( "<h><hv><h>" ) foot = style.format( "<h><hu><h>" ) new( head, row, div, row, div, nil, foot, head, foot ) end |
.default_left_edge(style) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/monocle-print/table/segments.rb', line 29 def self.default_left_edge( style ) head = style.format( "<dr><h>" ) row = style.format( "<v> " ) div = style.format( "<vr><h>" ) foot = style.format( "<ur><h>" ) new( head, row, div, row, div, row, div, div, foot ) end |
.default_right_edge(style) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/monocle-print/table/segments.rb', line 37 def self.default_right_edge( style ) head = style.format( "<h><dl>" ) row = style.format( " <v>" ) div = style.format( "<h><vl>" ) foot = style.format( "<h><ul>" ) new( head, row, div, row, div, row, div, div, foot ) end |
Instance Method Details
#mask(inclusion_settings) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/monocle-print/table/segments.rb', line 45 def mask( inclusion_settings ) masked = self.class.new each_pair do | name, text | if text and inclusion_settings[ name ] masked[ name ] = text end end return( masked ) end |
#width(inclusion_mask = nil) ⇒ Object
55 56 57 58 |
# File 'lib/monocle-print/table/segments.rb', line 55 def width( inclusion_mask = nil ) inclusion_mask and return( self.mask( inclusion_mask ).width ) return( map { |text| text ? text.width : 0 }.max ) end |