class method
Etc::Passwd.each
() -> untyped
Etc::Passwd.each { |struct| block } → Etc::Passwd
Etc::Passwd.each → Enumerator
ext/etc/etc.c
View on GitHub ↗
static VALUE
etc_each_passwd(VALUE obj)
{
#ifdef HAVE_GETPWENT
RETURN_ENUMERATOR(obj, 0, 0);
each_passwd();
#endif
return obj;
}
Iterates for each entry in the /etc/passwd file if a block is given.
If no block is given, returns the Enumerator.
The code block is passed an Passwd struct.
See Etc.getpwent above for details.
Example:
Example
require 'etc' Etc::Passwd.each {|u| puts u.name + " = " + u.gecos } Etc::Passwd.collect {|u| u.gecos} Etc::Passwd.collect {|u| u.gecos}