Sha256: f8559f8cc655fd579f11f67b1f786ca6dbea2edd3fa2f17c074b1793103e03db

Contents?: true

Size: 711 Bytes

Versions: 14

Compression:

Stored size: 711 Bytes

Contents

class RakeCommander
  module Options
    module Error
      # Relates to `OptionParser#parse` output (**leftovers**)
      class UnknownArgument < RakeCommander::Options::Error::Base
        def initialize(value = nil, from: nil)
          super("unknown arguments: #{to_message(value)}", from: from)
        end

        def leftovers
          case @value
          when Array
            @value
          else
            []
          end
        end

        private

        def to_message(value)
          case value
          when Array
            value.map {|v| "'#{v}'"}.join(', ')
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rake-commander-0.4.0 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.3.6 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.3.5 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.3.3 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.12 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.11 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.10 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.7 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.6 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.5 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.4 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.3 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.2 lib/rake-commander/options/error/unknown_argument.rb
rake-commander-0.2.0 lib/rake-commander/options/error/unknown_argument.rb