Method: Bundler::Thor::Base::ClassMethods#class_at_least_one

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

#class_at_least_one(*args, &block) ⇒ Object

Adds and declares option group for required at least one of options in the block and arguments. You can declare options as the outside of the block.

Examples

class_at_least_one do
  class_option :one
  class_option :two
 end

Or

class_option :one
class_option :two
class_at_least_one :one, :two

If you do not give “–one” and “–two” AtLeastOneRequiredArgumentError will be raised.

You can use class_at_least_one and class_exclusive at the same time.

class_exclusive do
  class_at_least_one do
    class_option :one
    class_option :two
  end
end

Then it is required either only one of “–one” or “–two”.

[View source]

392
393
394
395
# File 'lib/bundler/vendor/thor/lib/thor/base.rb', line 392

def class_at_least_one(*args, &block)
  register_options_relation_for(:class_options,
                                :class_at_least_one_option_names, *args, &block)
end