Module: CSVPlusPlus::Modifier

Extended by:
T::Sig
Defined in:
lib/csv_plus_plus/modifier.rb,
lib/csv_plus_plus/modifier/expand.rb,
lib/csv_plus_plus/modifier/modifier.rb,
lib/csv_plus_plus/modifier/data_validation.rb,
lib/csv_plus_plus/modifier/rubyxl_modifier.rb,
lib/csv_plus_plus/modifier/modifier_validator.rb,
lib/csv_plus_plus/modifier/google_sheet_modifier.rb,
lib/csv_plus_plus/modifier/conditional_formatting.rb

Overview

All modifier-specific logic is hidden in this module and callers should just call #new on this module.

Defined Under Namespace

Classes: BorderSide, BorderStyle, ConditionalFormatting, DataValidation, Expand, GoogleSheetModifier, HorizontalAlign, Modifier, ModifierValidator, NumberFormat, RubyXLModifier, TextFormat, VerticalAlign

Class Method Summary collapse

Class Method Details

.new(options, row_level: false) ⇒ ValidatedModifier

Return a Modifier with the proper validation and helper functions attached for the given output

Parameters:

  • options (boolean)

    is this a row level modifier? (otherwise cell-level)

  • row_level (boolean) (defaults to: false)

    is this a row level modifier? (otherwise cell-level)

Returns:

  • (ValidatedModifier)


91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/csv_plus_plus/modifier.rb', line 91

def self.new(options, row_level: false)
  output_format = options.output_format
  case output_format
  when ::CSVPlusPlus::Options::OutputFormat::CSV, ::CSVPlusPlus::Options::OutputFormat::OpenDocument
    ::CSVPlusPlus::Modifier::Modifier.new(row_level:)
  when ::CSVPlusPlus::Options::OutputFormat::Excel
    ::CSVPlusPlus::Modifier::RubyXLModifier.new(row_level:)
  when ::CSVPlusPlus::Options::OutputFormat::GoogleSheets
    ::CSVPlusPlus::Modifier::GoogleSheetModifier.new(row_level:)
  else ::T.absurd(output_format)
  end
end