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
[View source]

426
427
428
429
430
431
432
433
# File 'lib/bundler/vendor/thor/lib/thor/base.rb', line 426

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