Class: Etc::Passwd
- Inherits:
-
Struct
- Object
- Struct
- Etc::Passwd
- Defined in:
- ext/etc/etc.c
Class Method Summary collapse
-
.each ⇒ Object
Etc::Passwd.each { |struct| block } -> Etc::Passwd Etc::Passwd.each -> Enumerator.
Class Method Details
.each ⇒ Object
Etc::Passwd.each { |struct| block } -> Etc::Passwd Etc::Passwd.each -> Enumerator
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:
require 'etc'
Etc::Passwd.each {|u|
puts u.name + " = " + u.gecos
}
Etc::Passwd.collect {|u| u.gecos}
Etc::Passwd.collect {|u| u.gecos}
370 371 372 373 374 375 376 377 378 |
# File 'ext/etc/etc.c', line 370
static VALUE
etc_each_passwd(VALUE obj)
{
#ifdef HAVE_GETPWENT
RETURN_ENUMERATOR(obj, 0, 0);
each_passwd();
#endif
return obj;
}
|