Module: Wpxf::Cli::ModuleInfo

Included in:
LoadedModule
Defined in:
lib/wpxf/cli/module_info.rb

Overview

Helper methods for outputing information about the currently loaded module.

Instance Method Summary collapse

Instance Method Details

#formatted_module_descriptionObject



16
17
18
19
20
21
22
# File 'lib/wpxf/cli/module_info.rb', line 16

def formatted_module_description
  if context.module.module_description_preformatted
    indent_without_wrap(context.module.module_desc)
  else
    remove_new_lines_and_wrap_text(context.module.module_desc).strip
  end
end

#infoObject



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/wpxf/cli/module_info.rb', line 47

def info
  return unless module_loaded?(false)

  print_module_summary
  puts
  print_author
  puts
  show_options
  puts
  print_description
  puts
  print_references
end


7
8
9
10
11
12
13
14
# File 'lib/wpxf/cli/module_info.rb', line 7

def print_author
  print_std('Provided by:')
  indent_cursor do
    context.module.module_author.each do |author|
      print_std(author)
    end
  end
end


24
25
26
27
28
29
# File 'lib/wpxf/cli/module_info.rb', line 24

def print_description
  print_std('Description:')
  indent_cursor do
    print_std formatted_module_description
  end
end


31
32
33
34
35
# File 'lib/wpxf/cli/module_info.rb', line 31

def print_module_summary
  print_std("       Name: #{context.module.module_name}")
  print_std("     Module: #{context.module_path}")
  print_std("  Disclosed: #{context.module.module_date}")
end


37
38
39
40
41
42
43
44
45
# File 'lib/wpxf/cli/module_info.rb', line 37

def print_references
  return unless context.module.module_references
  print_std('References:')
  indent_cursor do
    context.module.module_references.each do |ref|
      print_std Wpxf::Utility::ReferenceInflater.new(ref[0]).inflate(ref[1])
    end
  end
end