summaryrefslogtreecommitdiff
path: root/doc/optparse/ruby/parse_bang.rb
diff options
context:
space:
mode:
Diffstat (limited to 'doc/optparse/ruby/parse_bang.rb')
-rw-r--r--doc/optparse/ruby/parse_bang.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/optparse/ruby/parse_bang.rb b/doc/optparse/ruby/parse_bang.rb
new file mode 100644
index 0000000000..567bc733cf
--- /dev/null
+++ b/doc/optparse/ruby/parse_bang.rb
@@ -0,0 +1,13 @@
+require 'optparse'
+parser = OptionParser.new
+parser.on('--xxx') do |value|
+ p ['--xxx', value]
+end
+parser.on('--yyy YYY') do |value|
+ p ['--yyy', value]
+end
+parser.on('--zzz [ZZZ]') do |value|
+ p ['--zzz', value]
+end
+ret = parser.parse!
+puts "Returned: #{ret} (#{ret.class})"