Skip to content
class method

Etc.group

() { (::Etc::Group group) -> void } -> void
() -> ::Etc::Group?
group { |struct| block }
group → Etc::Group

Provides a convenient Ruby iterator which executes a block for each entry in the /etc/group file.

The code block is passed an Group struct.

See ::getgrent above for details.

Example:

Example
require 'etc'

Etc.group {|g|
  puts g.name + ": " + g.mem.join(', ')
}
See also .getpwuid .nprocessors .getpwnam .passwd also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0