Class: Etc::Group

Inherits:
Struct
  • Object
show all
Defined in:
ext/etc/etc.c

Class Method Summary collapse

Class Method Details

.eachObject

Etc::Group.each { |group| block } -> Etc::Group Etc::Group.each -> Enumerator

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:

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?}


623
624
625
626
627
628
629
# File 'ext/etc/etc.c', line 623

static VALUE
etc_each_group(VALUE obj)
{
    RETURN_ENUMERATOR(obj, 0, 0);
    each_group();
    return obj;
}