summaryrefslogtreecommitdiff
path: root/doc/optparse/ruby/proc.rb
blob: 9c669fdc92a17ffa4022f3d9b264cdf19a1af4a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'optparse'
parser = OptionParser.new
parser.on(
  '--xxx',
  'Option with no argument',
  ->(value) {p ['Handler proc for -xxx called with value:', value]}
)
parser.on(
  '--yyy YYY',
  'Option with required argument',
  ->(value) {p ['Handler proc for -yyy called with value:', value]}
)
parser.parse!