class Arrival::UserOptions

Encapsulates the pt-online-schema-change options defined by the user

Attributes

arguments[R]

Public Class Methods

new(arguments = ENV['PERCONA_ARGS']) click to toggle source

Constructor

@param arguments [String]

# File lib/arrival/user_options.rb, line 9
def initialize(arguments = ENV['PERCONA_ARGS'])
  @arguments = arguments
end

Private Instance Methods

build_options() click to toggle source

Builds Option instances from the user arguments

@return [Array<Option>]

# File lib/arrival/user_options.rb, line 38
def build_options
  arguments.split(/\s(?=-)/).map do |argument|
    Option.from_string(argument)
  end
end
to_set() click to toggle source

Returns the arguments the user defined but without duplicates

@return [Set]

# File lib/arrival/user_options.rb, line 20
def to_set
  Set.new(user_options)
end
user_options() click to toggle source

Returns Option instances from the arguments the user specified, if any

@return [Array]

# File lib/arrival/user_options.rb, line 27
def user_options
  if arguments
    build_options
  else
    []
  end
end