Method: Mac::Group#group_list

Defined in:
lib/beaker/host/mac/group.rb

#group_list(&block) ⇒ Array<String>

Gets a list of group names on the system

Parameters:

  • block (Proc)

    Additional actions or insertions

Returns:

  • (Array<String>)

    The list of group names on the system



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/beaker/host/mac/group.rb', line 9

def group_list(&block)
  execute('dscacheutil -q group') do |result|
    groups = []
    result.stdout.each_line do |line|
      groups << line.split(': ')[1].strip if line =~ /^name:/
    end

    yield result if block_given?

    groups
  end
end