Module: WpUsers::Output

Included in:
WpUsers
Defined in:
lib/common/collections/wp_users/output.rb

Instance Method Summary (collapse)

Instance Method Details

- (void) output(options = {})

This method returns an undefined value.

Parameters:

  • options (Hash) (defaults to: {})
  • options[ (Hash)

    a customizable set of options



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/common/collections/wp_users/output.rb', line 10

def output(options = {})
  rows     = []
  headings = ['Id', 'Login', 'Name']
  headings << 'Password' if options[:show_password]

  self.each do |wp_user|
    row = [wp_user.id, wp_user., wp_user.display_name]
    row << wp_user.password if options[:show_password]
    rows << row
  end

  puts Terminal::Table.new(headings: headings,
                           rows: rows,
                           style: { margin_left: options[:margin_left] || '' })
end