Class: BerkeleyLibrary::TIND::Export::TableMetrics

Inherits:
Object
  • Object
show all
Includes:
Logging, Config
Defined in:
lib/berkeley_library/tind/export/table_metrics.rb

Constant Summary

Constants included from Config

Config::FONT_SIZE_DEFAULT, Config::FORMAT_DIGITS_DEFAULT, Config::HEIGHT_INCREMENT_DEFAULT_POINTS, Config::LINE_HEIGHT_DEFAULT_EM, Config::MAX_COLUMN_WIDTH_INCHES, Config::WIDTH_INCREMENT_DEFAULT_INCHES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Config

#font_size_pt, font_size_pt, font_size_pt=, #format_digits, format_digits, format_digits=, #h_incr_pt, h_incr_pt, h_incr_pt=, #line_height_em, line_height_em, line_height_em=, #max_col_width_in, max_col_width_in, max_col_width_in=, w_incr_in, #w_incr_in, w_incr_in=

Constructor Details

#initialize(table) ⇒ TableMetrics

Initializes a new set of metrics for the specified table.

Parameters:

  • table (Table)

    the table



18
19
20
# File 'lib/berkeley_library/tind/export/table_metrics.rb', line 18

def initialize(table)
  @table = table
end

Instance Attribute Details

#tableTable (readonly)

Returns the table.

Returns:



13
14
15
# File 'lib/berkeley_library/tind/export/table_metrics.rb', line 13

def table
  @table
end

Instance Method Details

#formatted_width(col_index) ⇒ Object



22
23
24
25
# File 'lib/berkeley_library/tind/export/table_metrics.rb', line 22

def formatted_width(col_index)
  inches_numeric = numeric_column_width(col_index)
  format_inches(inches_numeric)
end

#row_metrics_for(row_index) ⇒ Object



27
28
29
30
# File 'lib/berkeley_library/tind/export/table_metrics.rb', line 27

def row_metrics_for(row_index)
  @metrics_by_row ||= []
  @metrics_by_row[row_index] ||= calc_row_metrics(row_index)
end