class Clamp::Help::Builder
Constants
- DETAIL_FORMAT
Public Class Methods
new()
click to toggle source
# File lib/clamp/help.rb, line 56 def initialize @out = StringIO.new end
Public Instance Methods
add_description(description)
click to toggle source
# File lib/clamp/help.rb, line 71 def add_description(description) if description puts "" puts description.gsub(/^/, " ") end end
add_list(heading, items)
click to toggle source
# File lib/clamp/help.rb, line 80 def add_list(heading, items) puts "\n#{heading}:" items.reject { |i| i.respond_to?(:hidden?) && i.hidden? }.each do |item| label, description = item.help description.each_line do |line| puts DETAIL_FORMAT % [label, line] label = '' end end end
add_usage(invocation_path, usage_descriptions)
click to toggle source
# File lib/clamp/help.rb, line 64 def add_usage(invocation_path, usage_descriptions) puts Clamp.message(:usage_heading) + ":" usage_descriptions.each do |usage| puts " #{invocation_path} #{usage}".rstrip end end
string()
click to toggle source
# File lib/clamp/help.rb, line 60 def string @out.string end
Private Instance Methods
puts(*args)
click to toggle source
# File lib/clamp/help.rb, line 93 def puts(*args) @out.puts(*args) end