Method: Gem::OptionParser::List#summarize
- Defined in:
- lib/rubygems/vendor/optparse/lib/optparse.rb
#summarize(*args, &block) ⇒ Object
Creates the summary table, passing each line to the block (without newline). The arguments args are passed along to the summarize method which is called on every option.
| 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | # File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 955 def summarize(*args, &block) sum = [] list.reverse_each do |opt| if opt.respond_to?(:summarize) # perhaps Gem::OptionParser::Switch s = [] opt.summarize(*args) {|l| s << l} sum.concat(s.reverse) elsif !opt or opt.empty? sum << "" elsif opt.respond_to?(:each_line) sum.concat([*opt.each_line].reverse) else sum.concat([*opt.each].reverse) end end sum.reverse_each(&block) end |