summaryrefslogtreecommitdiff
path: root/lib/slop.rb
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2013-06-16 09:24:54 +0100
committerLee Jarvis <ljjarvis@gmail.com>2013-08-13 20:34:42 +0100
commited6b84ae16a7a5657b579b5929e474efecfa220e (patch)
tree489a96629d6fd59edd2f89ffdc9610f7803c1ab3 /lib/slop.rb
parent9e4dbd28675328bafca95ad247a9cc1285242b6c (diff)
downloadslop-ed6b84ae16a7a5657b579b5929e474efecfa220e.tar.gz
remove deprecated Slop.optspec
Diffstat (limited to 'lib/slop.rb')
-rw-r--r--lib/slop.rb45
1 files changed, 0 insertions, 45 deletions
diff --git a/lib/slop.rb b/lib/slop.rb
index 3a5c9d0..95c10eb 100644
--- a/lib/slop.rb
+++ b/lib/slop.rb
@@ -65,51 +65,6 @@ class Slop
slop.parse! items
slop
end
-
- # Build a Slop object from a option specification.
- #
- # This allows you to design your options via a simple String rather
- # than programatically. Do note though that with this method, you're
- # unable to pass any advanced options to the on() method when creating
- # options.
- #
- # string - The optspec String
- # config - A Hash of configuration options to pass to Slop.new
- #
- # Examples:
- #
- # opts = Slop.optspec(<<-SPEC)
- # ruby foo.rb [options]
- # ---
- # n,name= Your name
- # a,age= Your age
- # A,auth Sign in with auth
- # p,passcode= Your secret pass code
- # SPEC
- #
- # opts.fetch_option(:name).description #=> "Your name"
- #
- # Returns a new instance of Slop.
- def optspec(string, config = {})
- warn "[DEPRECATED] `Slop.optspec` is deprecated and will be removed in version 4"
- config[:banner], optspec = string.split(/^--+$/, 2) if string[/^--+$/]
- lines = optspec.split("\n").reject(&:empty?)
- opts = Slop.new(config)
-
- lines.each do |line|
- opt, description = line.split(' ', 2)
- short, long = opt.split(',').map { |s| s.sub(/\A--?/, '') }
- opt = opts.on(short, long, description)
-
- if long && long.end_with?('=')
- long.sub!(/\=$/, '')
- opt.config[:argument] = true
- end
- end
-
- opts
- end
-
end
# The Hash of configuration options for this Slop instance.