Project

General

Profile

Bug #13722 ยป ruby-op-octal-bug.rb

Reproduces the bug - wmccumstie (William McCumstie), 07/06/2017 09:58 AM

 
1
#!/usr/local/bin/ruby
2
require 'optionparser'
3

    
4
input = ["--decimal", "035"]
5
results = {}
6
op = OptionParser.new
7

    
8
op.on("--decimal NUMBER", OptionParser::DecimalInteger,
9
      "DecimalInteger bug will convert as octal") do |v|
10
  results[:decimal] = v
11
end
12

    
13
op.parse(input)
14

    
15
puts "Input: #{input[1]}"
16
puts "Parsed: #{results[:decimal]}"