class Guard::Dsl

def group(*args)

Other tags:
    See: #guard -
    See: Guard.add_group -
    See: Group -

Other tags:
    Yield: - a block where you can declare several Guard plugins

Parameters:
  • options (Hash) -- the options accepted by the group
  • name (Symbol, String, Array) -- the group name called

Other tags:
    Example: Declare two groups of Guard plugins -
def group(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  groups = args
  groups.each do |group|
    next unless group.to_sym == :all
    fail ArgumentError, "'all' is not an allowed group name!"
  end
  if block_given?
    groups.each do |group|
      # TODO: let groups be added *after* evaluation
      Guard.state.session.groups.add(group, options)
    end
    @current_groups ||= []
    @current_groups.push(groups)
    yield
    @current_groups.pop
  else
    UI.error \
      "No Guard plugins found in the group '#{ groups.join(', ') }',"\
      " please add at least one."
  end
end