Class: Options
Overview
Override methods in Options to in effect incorporate the accessor flags for CDoc parsing. (see ‘rdoc/options’) Raise an error if an accessor flag has already been specified.
Instance Method Summary collapse
Instance Method Details
#cdoc_original_parse ⇒ Object
:nodoc:
384 |
# File 'lib/cdoc.rb', line 384 alias cdoc_original_parse parse |
#parse(argv, generators) ⇒ Object
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/cdoc.rb', line 386 def parse(argv, generators) cdoc_original_parse(argv, generators) return unless @generator_name == 'cdoc' accessors = CDoc::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("cdoc 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 CDoc::InitializeConfigParser end |