Method: Bundler::Thor::Base::ClassMethods#remove_argument

Defined in:
lib/bundler/vendor/thor/lib/thor/base.rb

#remove_argument(*names) ⇒ Object

Removes a previous defined argument. If :undefine is given, undefine accessors as well.

Parameters

names<Array>

Arguments to be removed

Examples

remove_argument :foo
remove_argument :foo, :bar, :baz, :undefine => true


288
289
290
291
292
293
294
295
# File 'lib/bundler/vendor/thor/lib/thor/base.rb', line 288

def remove_argument(*names)
  options = names.last.is_a?(Hash) ? names.pop : {}

  names.each do |name|
    arguments.delete_if { |a| a.name == name.to_s }
    undef_method name, "#{name}=" if options[:undefine]
  end
end