Class: CSVPlusPlus::Writer::GoogleSheetModifier
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- CSVPlusPlus::Writer::GoogleSheetModifier
- Defined in:
- lib/csv_plus_plus/writer/google_sheet_modifier.rb
Overview
Decorate a Modifier so it can be written to the Google Sheets API
Instance Method Summary collapse
-
#border ⇒ Google::Apis::SheetsV4::Border
Format the border for Google Sheets.
-
#color ⇒ Google::Apis::SheetsV4::Color
Format the color for Google Sheets.
-
#fontcolor ⇒ Google::Apis::SheetsV4::Color
Format the fontcolor for Google Sheets.
-
#halign ⇒ String
Format the halign for Google Sheets.
-
#numberformat ⇒ ::Google::Apis::SheetsV4::NumberFormat
Format the numberformat for Google Sheets.
-
#text_format ⇒ ::Google::Apis::SheetsV4::TextFormat
Builds a SheetsV4::TextFormat with the underlying Modifier.
-
#valign ⇒ Object
Format the valign for Google Sheets.
Instance Method Details
#border ⇒ Google::Apis::SheetsV4::Border
Format the border for Google Sheets
10 11 12 13 14 15 16 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 10 def border # TODO: allow different border styles per side ::Google::Apis::SheetsV4::Border.new( color: bordercolor&.to_s || '#000000', style: borderstyle&.to_s || 'solid' ) end |
#color ⇒ Google::Apis::SheetsV4::Color
Format the color for Google Sheets
21 22 23 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 21 def color google_sheets_color(super) if super end |
#fontcolor ⇒ Google::Apis::SheetsV4::Color
Format the fontcolor for Google Sheets
28 29 30 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 28 def fontcolor google_sheets_color(super) if super end |
#halign ⇒ String
Format the halign for Google Sheets
35 36 37 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 35 def halign super&.to_s&.upcase end |
#numberformat ⇒ ::Google::Apis::SheetsV4::NumberFormat
Format the numberformat for Google Sheets
42 43 44 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 42 def numberformat ::Google::Apis::SheetsV4::NumberFormat.new(type: super) if super end |
#text_format ⇒ ::Google::Apis::SheetsV4::TextFormat
Builds a SheetsV4::TextFormat with the underlying Modifier
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 49 def text_format ::Google::Apis::SheetsV4::TextFormat.new( bold: formatted?(:bold) || nil, italic: formatted?(:italic) || nil, strikethrough: formatted?(:strikethrough) || nil, underline: formatted?(:underline) || nil, font_family: fontfamily, font_size: fontsize, foreground_color: fontcolor ) end |
#valign ⇒ Object
Format the valign for Google Sheets
62 63 64 |
# File 'lib/csv_plus_plus/writer/google_sheet_modifier.rb', line 62 def valign super&.to_s&.upcase end |