Method: Puppet::Etc.group
- Defined in:
- lib/puppet/etc.rb
.group ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Etc::group returns a Ruby iterator that executes a block for each entry in the /etc/group file. The code-block is passed a Group struct. See getgrent above for more details.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/puppet/etc.rb', line 110 def group # The implementation here duplicates the logic in https://github.com/ruby/etc/blob/master/ext/etc/etc.c#L523-L537 # Note that we do not call ::Etc.group directly, because we # want to use our wrappers for methods like getgrent, setgrent, # endgrent, etc. return getgrent unless block_given? setgrent begin while cur_group = getgrent # rubocop:disable Lint/AssignmentInCondition yield cur_group end ensure endgrent end end |