Class: Charyf::Generators::ARGVScrubber

Inherits:
Object
  • Object
show all
Defined in:
lib/charyf/utils/generators/app/app_generator.rb

Overview

This class handles preparation of the arguments before the AppGenerator is called.

This class should be called before the AppGenerator is required and started since it configures and mutates ARGV correctly.

Constant Summary collapse

VERSION_ARGS =

:nodoc:

%w(--version -v)

Instance Method Summary collapse

Constructor Details

#initialize(argv = ARGV) ⇒ ARGVScrubber

Returns a new instance of ARGVScrubber.



243
244
245
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 243

def initialize(argv = ARGV)
  @argv = argv
end

Instance Method Details

#prepare!Object



248
249
250
251
252
253
# File 'lib/charyf/utils/generators/app/app_generator.rb', line 248

def prepare!
  handle_version_request!(@argv.first)
  handle_invalid_command!(@argv.first, @argv) do
    return @argv.drop(1)
  end
end