Method: CommandLine::OptionParser#get_posix_re
- Defined in:
- lib/commandline/optionparser/optionparser.rb
#get_posix_re ⇒ Object
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/commandline/optionparser/optionparser.rb', line 293 def get_posix_re flags = [] nflags = [] @options.each { |o| if [0,0] == o.arity flags << o.names[0][1..1] else nflags << o.names[0][1..1] end } flags = flags.join flags = flags.empty? ? "" : "[#{flags}\]+" nflags = nflags.join nflags = nflags.empty? ? "" : "[#{nflags}\]" Regexp.new("^-(#{flags})(#{nflags})(.*)\$") end |