Class: OptionParser::Switch
- Inherits:
-
Object
- Object
- OptionParser::Switch
- Defined in:
- lib/rabbit/console/roff.rb
Instance Method Summary collapse
Instance Method Details
#summarize_as_roff {|'.TP'| ... } ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rabbit/console/roff.rb', line 20 def summarize_as_roff(&block) var = nil opt_str = [@short, @long].flatten.collect {|s| "\\fB#{::OptionParser.roff_escape(s)}\\fR" }.join(', ') opt_str << arg.sub(/\A([=\s\[]*)(.+?)([\s\]]*)\z/) { var = $2 "#{$1}\\fI#{$2}\\fR#{$3}" } if arg yield('.TP') yield(opt_str) desc.each do |d| d_str = ::OptionParser.roff_escape(d) d_str.gsub!(var) { "\\fI#{var}\\fR" } if var yield(d_str) end end |