Class: RVGP::Plot::GoogleDrive::Sheet
- Inherits:
-
Object
- Object
- RVGP::Plot::GoogleDrive::Sheet
- Defined in:
- lib/rvgp/plot/google-drive/sheet.rb
Overview
This class represents a csv-like matrix, that is to be sent to google, as a sheet in an exported workbook. There’s not much logic here.
Constant Summary collapse
- MAX_COLUMNS =
This is the maximum number of columns that we support, in our sheets. This number is mostly here because Google stipulates this restriction
26
Instance Attribute Summary collapse
-
#options ⇒ Hash
The options configured on this sheet.
-
#title ⇒ string
The title of this sheet.
Instance Method Summary collapse
-
#columns ⇒ Array<Object>
The column titles for this spreadsheet, as calculated from the provided data.
-
#initialize(title, grid, options = {}) ⇒ Sheet
constructor
A sheet, and its options.
-
#rows ⇒ Array<Object>
The rows values for this spreadsheet, as calculated from the provided data.
Constructor Details
#initialize(title, grid, options = {}) ⇒ Sheet
A sheet, and its options.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rvgp/plot/google-drive/sheet.rb', line 40 def initialize(title, grid, = {}) @title = title @options = @grid = grid # This is a Google constraint: if columns.length > MAX_COLUMNS raise StandardError, format('Too many columns. Max is %<max>d, provided %<provided>d.', max: MAX_COLUMNS, provided: columns.length) end end |
Instance Attribute Details
#options ⇒ Hash
The options configured on this sheet
10 11 12 |
# File 'lib/rvgp/plot/google-drive/sheet.rb', line 10 def @options end |
#title ⇒ string
The title of this sheet
10 11 12 |
# File 'lib/rvgp/plot/google-drive/sheet.rb', line 10 def title @title end |
Instance Method Details
#columns ⇒ Array<Object>
The column titles for this spreadsheet, as calculated from the provided data.
55 56 57 |
# File 'lib/rvgp/plot/google-drive/sheet.rb', line 55 def columns @grid[0] end |
#rows ⇒ Array<Object>
The rows values for this spreadsheet, as calculated from the provided data.
61 62 63 |
# File 'lib/rvgp/plot/google-drive/sheet.rb', line 61 def rows @grid[1...] end |