# File lib/net/ssh/multi/session.rb, line 213
213:     def group(*args)
214:       mapping = args.last.is_a?(Hash) ? args.pop : {}
215: 
216:       if mapping.any? && block_given?
217:         raise ArgumentError, "must provide group mapping OR block, not both"
218:       elsif block_given?
219:         begin
220:           saved_groups = open_groups.dup
221:           open_groups.concat(args.map { |a| a.to_sym }).uniq!
222:           yield self
223:         ensure
224:           open_groups.replace(saved_groups)
225:         end
226:       else
227:         mapping.each do |key, value|
228:           (open_groups + Array(key)).uniq.each do |grp|
229:             groups[grp.to_sym].concat(Array(value))
230:           end
231:         end
232:       end
233:     end