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.



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

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

Instance Method Details

#prepare!Object



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

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