Module: BerkeleyLibrary::TIND::Export::Config

Included in:
ColumnWidthCalculator, TableMetrics
Defined in:
lib/berkeley_library/tind/export/config.rb

Constant Summary collapse

FONT_SIZE_DEFAULT =

Font size in points

10.0
WIDTH_INCREMENT_DEFAULT_INCHES =

Round column widths up to nearest eighth inch

'1/8'.to_r
HEIGHT_INCREMENT_DEFAULT_POINTS =

Round row heights up to nearest 2 points

2
MAX_COLUMN_WIDTH_INCHES =

Max column width before wrapping

5.0
FORMAT_DIGITS_DEFAULT =

Decimal places for formatting

3
LINE_HEIGHT_DEFAULT_EM =

Line height as multiple of font size

'4/3'.to_r

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.font_size_ptNumeric

Returns the font size in points.

Returns:

  • (Numeric)

    the font size in points



58
59
60
# File 'lib/berkeley_library/tind/export/config.rb', line 58

def font_size_pt
  @font_size_pt ||= ensure_positive_numeric(ENV['ODS_FONT_SIZE_DEFAULT'] || Config::FONT_SIZE_DEFAULT)
end

.font_size_pt=(value) ⇒ Object



62
63
64
# File 'lib/berkeley_library/tind/export/config.rb', line 62

def font_size_pt=(value)
  @font_size_pt = ensure_positive_numeric(value)
end

.format_digitsInteger

Returns the number of digits to use when formatting values.

Returns:

  • (Integer)

    the number of digits to use when formatting values



103
104
105
# File 'lib/berkeley_library/tind/export/config.rb', line 103

def format_digits
  @format_digits ||= ensure_positive_int(ENV['ODS_FORMAT_DIGITS_DEFAULT'] || Config::FORMAT_DIGITS_DEFAULT)
end

.format_digits=(value) ⇒ Object



107
108
109
# File 'lib/berkeley_library/tind/export/config.rb', line 107

def format_digits=(value)
  @format_digits = ensure_positive_int(value)
end

.h_incr_ptNumeric

Returns the height rounding increment in points.

Returns:

  • (Numeric)

    the height rounding increment in points



85
86
87
# File 'lib/berkeley_library/tind/export/config.rb', line 85

def h_incr_pt
  @h_incr_pt ||= ensure_positive_numeric(ENV['ODS_HEIGHT_INCREMENT_DEFAULT_POINTS'] || Config::HEIGHT_INCREMENT_DEFAULT_POINTS)
end

.h_incr_pt=(value) ⇒ Object



89
90
91
# File 'lib/berkeley_library/tind/export/config.rb', line 89

def h_incr_pt=(value)
  @h_incr_pt = ensure_positive_numeric(value)
end

.line_height_emNumeric

Returns the line height in ems (multiples of the font point size).

Returns:

  • (Numeric)

    the line height in ems (multiples of the font point size)



94
95
96
# File 'lib/berkeley_library/tind/export/config.rb', line 94

def line_height_em
  @line_height_em ||= ensure_positive_numeric(ENV['ODS_LINE_HEIGHT_DEFAULT_EM'] || Config::LINE_HEIGHT_DEFAULT_EM)
end

.line_height_em=(value) ⇒ Object



98
99
100
# File 'lib/berkeley_library/tind/export/config.rb', line 98

def line_height_em=(value)
  @line_height_em = ensure_positive_numeric(value)
end

.max_col_width_inNumeric

Returns the max column width in inches.

Returns:

  • (Numeric)

    the max column width in inches



67
68
69
# File 'lib/berkeley_library/tind/export/config.rb', line 67

def max_col_width_in
  @max_col_width_in ||= ensure_positive_numeric(ENV['ODS_MAX_COLUMN_WIDTH_INCHES'] || Config::MAX_COLUMN_WIDTH_INCHES)
end

.max_col_width_in=(value) ⇒ Object



71
72
73
# File 'lib/berkeley_library/tind/export/config.rb', line 71

def max_col_width_in=(value)
  @max_col_width_in = ensure_positive_numeric(value)
end

.w_incr_inNumeric

Returns the width rounding increment in inches.

Returns:

  • (Numeric)

    the width rounding increment in inches



76
77
78
# File 'lib/berkeley_library/tind/export/config.rb', line 76

def w_incr_in
  @w_incr_in ||= ensure_positive_numeric(ENV['ODS_WIDTH_INCREMENT_DEFAULT_INCHES'] || Config::WIDTH_INCREMENT_DEFAULT_INCHES)
end

.w_incr_in=(value) ⇒ Object



80
81
82
# File 'lib/berkeley_library/tind/export/config.rb', line 80

def w_incr_in=(value)
  @w_incr_in = ensure_positive_numeric(value)
end

Instance Method Details

#font_size_ptNumeric

Returns the font size in points.

Returns:

  • (Numeric)

    the font size in points



25
26
27
# File 'lib/berkeley_library/tind/export/config.rb', line 25

def font_size_pt
  Config.font_size_pt
end

#format_digitsInteger

Returns the number of digits to use when formatting values.

Returns:

  • (Integer)

    the number of digits to use when formatting values



50
51
52
# File 'lib/berkeley_library/tind/export/config.rb', line 50

def format_digits
  Config.format_digits
end

#h_incr_ptNumeric

Returns the height rounding increment in points.

Returns:

  • (Numeric)

    the height rounding increment in points



40
41
42
# File 'lib/berkeley_library/tind/export/config.rb', line 40

def h_incr_pt
  Config.h_incr_pt
end

#line_height_emNumeric

Returns the line height in ems (multiples of the font point size).

Returns:

  • (Numeric)

    the line height in ems (multiples of the font point size)



45
46
47
# File 'lib/berkeley_library/tind/export/config.rb', line 45

def line_height_em
  Config.line_height_em
end

#max_col_width_inNumeric

Returns the max column width in inches.

Returns:

  • (Numeric)

    the max column width in inches



30
31
32
# File 'lib/berkeley_library/tind/export/config.rb', line 30

def max_col_width_in
  Config.max_col_width_in
end

#w_incr_inNumeric

Returns the width rounding increment in inches.

Returns:

  • (Numeric)

    the width rounding increment in inches



35
36
37
# File 'lib/berkeley_library/tind/export/config.rb', line 35

def w_incr_in
  Config.w_incr_in
end