class MonoclePrint::Table::Segments

Public Class Methods

default_filling( style ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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

Public Instance Methods

mask( inclusion_settings ) click to toggle source
# 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 ) click to toggle source
# 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