lib/rake/toolkit_program/command_option_parser.rb
##
# String explanation of the positional cardinality, for help
#
String explanation of the positional cardinality, for help
String explanation of the positional cardinality for help
def positional_cardinality_explanation
        @positional_cardinality_explanation.tap do |explicit|
          return explicit if explicit
        end
        obscure_answer = "A rule exists about the number of positional arguments."
        case (pc_test = @positional_cardinality_test)
        when nil, 0 then nil
        when 1 then "Requires 1 positional argument."
        when Integer then "Requires #{pc_test} positional arguments."
        when Range then "Requires #{pc_test.to_inclusive} (inclusive) positional arguments."
        when Proc then begin
          [pc_test.call(:explain)].map do |exp|
            case exp
            when String then exp
            else obscure_answer
            end
          end[0]
        rescue StandardError
          obscure_answer
        end
        else obscure_answer
        end
      end
def positional_cardinality_explanation @positional_cardinality_explanation . tap do | explicit | return explicit if explicit end obscure_answer = "A rule exists about the number of positional arguments." case ( pc_test = @positional_cardinality_test ) when nil , 0 then nil when 1 then "Requires 1 positional argument." when Integer then "Requires #{pc_test} positional arguments." when Range then "Requires #{pc_test.to_inclusive} (inclusive) positional arguments." when Proc then begin [ pc_test . call ( :explain ) ] . map do | exp | case exp when String then exp else obscure_answer end end [ 0 ] rescue StandardError obscure_answer end else obscure_answer end end
String explanation of the positional cardinality, for help
String explanation of the positional cardinality for help