Sha256: 476b66a36b77f4af8154af462d2aa863df11835894eecb8ac942fca71d7bd650

Contents?: true

Size: 512 Bytes

Versions: 9

Compression:

Stored size: 512 Bytes

Contents

# Patches the underling OptionParser DecimalInteger type so that it doesn't
# convert numbers starting with a '0' as if they are an Octal number
module Commander
  module Patches
    module DecimalInteger
      decimal = '\d+(?:_\d+)*'
      DecimalInteger = /\A[-+]?#{decimal}\z/io
      ::OptionParser::accept(DecimalInteger, DecimalInteger) {|s,|
        begin
          Integer(s, 10)
        rescue ArgumentError
          raise ::OptionParser::InvalidArgument, s
        end if s
      }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
commander-openflighthpc-2.0.2 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-2.0.1 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-2.0.0 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-1.2.0 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-1.1.2 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-1.1.1 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-1.1.0 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-1.0.0 lib/commander/patches/decimal-integer.rb
commander-openflighthpc-1.0.0.pre.alpha1 lib/commander/patches/decimal-integer.rb