Method: Pry::Slop#fetch_option
- Defined in:
- lib/pry/slop.rb
#fetch_option(key) ⇒ Object
Fetch a Slop::Option object.
key - The Symbol or String option key.
Examples:
opts.on(:foo, 'Something fooey', :argument => :optional)
opt = opts.fetch_option(:foo)
opt.class #=> Slop::Option
opt.accepts_optional_argument? #=> true
Returns an Option or nil if none were found.
373 374 375 |
# File 'lib/pry/slop.rb', line 373 def fetch_option(key) .find { |option| [option.long, option.short].include?(clean(key)) } end |