Class: CSVPlusPlus::Options::Options

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/csv_plus_plus/options/options.rb

Overview

The options a user can supply (via CLI flags)

Direct Known Subclasses

FileOptions, GoogleSheetsOptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sheet_name) ⇒ Options

Initialize a defaul Options object



44
45
46
47
48
49
50
51
52
# File 'lib/csv_plus_plus/options/options.rb', line 44

def initialize(sheet_name)
  @backup = ::T.let(false, ::T::Boolean)
  @create_if_not_exists = ::T.let(false, ::T::Boolean)
  @key_values = ::T.let({}, ::T::Hash[::Symbol, ::CSVPlusPlus::Entities::Entity])
  @offset = ::T.let([0, 0], ::T::Array[::Integer])
  @overwrite_values = ::T.let(true, ::T::Boolean)
  @sheet_name = sheet_name
  @verbose = ::T.let(false, ::T::Boolean)
end

Instance Attribute Details

#backupBoolean

Create a backup of the spreadsheet before writing

Returns:

  • (Boolean)

    the current value of backup



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def backup
  @backup
end

#create_if_not_existsBoolean

Create the spreadsheet if it does not exist?

Returns:

  • (Boolean)

    the current value of create_if_not_exists



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def create_if_not_exists
  @create_if_not_exists
end

#key_valuesHash

Additional variables that can be supplied to the template

Returns:

  • (Hash)

    the current value of key_values



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def key_values
  @key_values
end

#offsetArray<Integer>

An [x, y] offset (array with two integers)

Returns:

  • (Array<Integer>)

    the current value of offset



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def offset
  @offset
end

#overwrite_valuesBoolean

Whether or not to overwrite existing values in the output spreadsheet.

Returns:

  • (Boolean)

    the current value of overwrite_values



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def overwrite_values
  @overwrite_values
end

#sheet_nameString

The name of the spreadsheet to write to

Returns:

  • (String)

    the current value of sheet_name



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def sheet_name
  @sheet_name
end

#verboseBoolean

Include extra verbose output?

Returns:

  • (Boolean)

    the current value of verbose



15
16
17
# File 'lib/csv_plus_plus/options/options.rb', line 15

def verbose
  @verbose
end

Instance Method Details

#output_formatOptions::OutputFormat

Given the options, figure out which type of OutputFormat we’ll be writing to



58
# File 'lib/csv_plus_plus/options/options.rb', line 58

def output_format; end

#verbose_summaryString

Return a string with a verbose description of what we’re doing with the options

Returns:

  • (String)


64
# File 'lib/csv_plus_plus/options/options.rb', line 64

def verbose_summary; end