Module: Writexlsx::Utility::SheetnameQuoting

Included in:
Chart::Pie, Chart::Series, ObjectPositioning
Defined in:
lib/write_xlsx/utility/sheetname_quoting.rb

Instance Method Summary collapse

Instance Method Details

#quote_sheetname(sheetname) ⇒ Object

Sheetnames used in references should be quoted if they contain any spaces, special characters or if the look like something that isn’t a sheet name. TODO. We need to handle more special cases.



12
13
14
15
16
17
18
# File 'lib/write_xlsx/utility/sheetname_quoting.rb', line 12

def quote_sheetname(sheetname) # :nodoc:
  name = sheetname.dup
  return name if already_quoted_sheetname?(name)
  return name unless sheetname_needs_quoting?(name)

  "'#{escape_sheetname(name)}'"
end