End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OptionParser::List#search
search(id, key) { |val| ... }
lib/optparse.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/optparse.rb, line 854
def search(id, key)
if list = __send__(id)
val = list.fetch(key) {return nil}
block_given? ? yield(val) : val
end
end
Searches key in id list. The result is returned or yielded if a block is given. If it isn’t found, nil is returned.