summaryrefslogtreecommitdiff
path: root/doc/optparse/ruby/parse.rb
diff options
context:
space:
mode:
Diffstat (limited to 'doc/optparse/ruby/parse.rb')
-rw-r--r--doc/optparse/ruby/parse.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/optparse/ruby/parse.rb b/doc/optparse/ruby/parse.rb
new file mode 100644
index 0000000000..a5d4329484
--- /dev/null
+++ b/doc/optparse/ruby/parse.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(ARGV)
+puts "Returned: #{ret} (#{ret.class})"