module Rodish::Plugins::ContextSensitiveHelp_::CommandMethods

  1. lib/rodish/plugins/_context_sensitive_help.rb

Methods

Public Instance

  1. context_help
  2. help_lines

Public Instance methods

context_help(context)

Render help with context-sensitive information.

[show source]
   # File lib/rodish/plugins/_context_sensitive_help.rb
24 def context_help(context)
25   lines = help_lines(include_context_help: true)
26   lines.map! do |line|
27     if line.is_a?(ContextHelp)
28       line.call(context)
29     else
30       line
31     end
32   end
33   lines.flatten!
34   lines.join("\n")
35 end
help_lines(include_context_help: false)

Exclude ContextHelp lines unless they are explicitly requested.

[show source]
   # File lib/rodish/plugins/_context_sensitive_help.rb
38 def help_lines(include_context_help: false)
39   lines = super()
40   lines.reject!{|l| l.is_a?(ContextHelp)} unless include_context_help
41   lines
42 end