Class: Options

Inherits:
Object show all
Defined in:
lib/tap/support/tdoc.rb

Overview

Override methods in Options to in effect incorporate the accessor flags for TDoc parsing. (see ‘rdoc/options’) Raise an error if an accessor flag has already been specified.

Instance Method Summary collapse

Instance Method Details

#parse(argv, generators) ⇒ Object



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/tap/support/tdoc.rb', line 382

def parse(argv, generators)
  tdoc_original_parse(argv, generators)
  return unless @generator_name == 'tdoc'
  
  accessors = Tap::Support::TDoc::ConfigParser::CONFIG_ACCESSORS
  
  # check the config_accessor_flags for accessor conflicts
  extra_accessor_flags.each_pair do |accessor, flag|
    if accessors.include?(accessor)
      raise OptionList.error("tdoc format already handles the accessor '#{accessor}'")
    end
  end
  
  # extra_accessors will be nil if no extra accessors were 
  # specifed, otherwise it'll be a regexp like /^(...)$/
  # the string subset assumes
  #   regexp.to_s # => /(?-mix:^(...)$)/  
  @extra_accessors ||= /^()$/ 
  current_accessors_str = @extra_accessors.to_s[9..-4]
  
  # echos the Regexp production code in rdoc/options.rb
  # (see the parse method, line 501)
  re = '^(' + current_accessors_str + accessors.map{|a| Regexp.quote(a)}.join('|') + ')$' 
  @extra_accessors = Regexp.new(re)
  
  RDoc::RubyParser.extend Tap::Support::TDoc::InitializeConfigParser 
end

#tdoc_original_parseObject

:nodoc:



380
# File 'lib/tap/support/tdoc.rb', line 380

alias tdoc_original_parse parse