End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Etc::Group.each
Etc::Group.each { |group| block } → obj
Etc::Group.each → Enumerator
ext/etc/etc.c
View on GitHub ↗
static VALUE
etc_each_group(VALUE obj)
{
RETURN_ENUMERATOR(obj, 0, 0);
each_group();
return obj;
}
Iterates for each entry in the /etc/group file if a block is given.
If no block is given, returns the Enumerator.
The code block is passed a Group struct.
Example:
Example
require 'etc' Etc::Group.each {|g| puts g.name + ": " + g.mem.join(', ') } Etc::Group.collect {|g| g.name} Etc::Group.select {|g| !g.mem.empty?}