class ThousandIsland::TableSettings

The TableSettings class is where you set up styling rules that can be used by your Table class. You may create a class that inherits from TableSettings, and then use it in any of your tables. You can sub-class your TableStyles so you may define a master style for your app, but then have derived styles for special situations.

Attributes

overrides[R]
pdf[R]

Public Class Methods

new(pdf, overrides={}) click to toggle source
# File lib/thousand_island/table_settings.rb, line 8
def initialize(pdf, overrides={})
  @pdf = pdf
  @overrides = overrides
end

Public Instance Methods

cell_styles() click to toggle source
# File lib/thousand_island/table_settings.rb, line 33
def cell_styles
  {
      borders: [:top, :bottom],
      border_width: 0.5,
      inline_format: true,
      size: 10
  }
end
default_options() click to toggle source
# File lib/thousand_island/table_settings.rb, line 22
def default_options
  {
      width: pdf.bounds.width,
      cell_style: cell_styles,
      position: :center,
      header_format: header_format,
      header_repeat: true,
      footer_format: footer_format
  }
end
header_format() click to toggle source
# File lib/thousand_island/table_settings.rb, line 42
def header_format
  {
      align: :center,
      font_style: :bold
  }

end
settings() click to toggle source
# File lib/thousand_island/table_settings.rb, line 18
def settings
  deep_merger.merge_options(overrides, table_settings, default_options)
end
table_settings() click to toggle source

@TODO override this one!!! Do the docs…

# File lib/thousand_island/table_settings.rb, line 14
def table_settings
  {}
end

Private Instance Methods

deep_merger() click to toggle source
# File lib/thousand_island/table_settings.rb, line 58
def deep_merger
  @deep_merger ||= Utilities::DeepMerge::TableOptions
end