Sha256: 95accb9ffbdb6401b81b71f59a2f4127629e519a52d1e49bd6e8daa108492184
Contents?: true
Size: 920 Bytes
Versions: 13
Compression:
Stored size: 920 Bytes
Contents
module Departure # Encapsulates the pt-online-schema-change options defined by the user class UserOptions delegate :each, :merge, to: :to_set # Constructor # # @param arguments [String] def initialize(arguments = ENV['PERCONA_ARGS']) @arguments = arguments end private attr_reader :arguments # Returns the arguments the user defined but without duplicates # # @return [Set] def to_set Set.new(user_options) end # Returns Option instances from the arguments the user specified, if any # # @return [Array] def user_options if arguments build_options else [] end end # Builds Option instances from the user arguments # # @return [Array<Option>] def build_options arguments.split(/\s(?=-)/).map do |argument| Option.from_string(argument) end end end end
Version data entries
13 entries across 13 versions & 3 rubygems