@@ -355,18 +355,24 @@ class RDoc::Options
355
355
# +--[no-]embed-mixins+ (Default is +false+.)
356
356
attr_accessor :embed_mixins
357
357
358
+ ##
359
+ # Exclude the default patterns as well if true.
360
+ attr_reader :apply_default_exclude
361
+
358
362
def initialize loaded_options = nil # :nodoc:
359
363
init_ivars
360
364
override loaded_options if loaded_options
361
365
end
362
366
367
+ DEFAULT_EXCLUDE = %w[
368
+ ~\z \. orig\z \. rej\z \. bak\z
369
+ \. gemspec\z
370
+ ]
371
+
363
372
def init_ivars # :nodoc:
364
373
@dry_run = false
365
374
@embed_mixins = false
366
- @exclude = %w[
367
- ~\z \. orig\z \. rej\z \. bak\z
368
- \. gemspec\z
369
- ]
375
+ @exclude = [ ]
370
376
@files = nil
371
377
@force_output = false
372
378
@force_update = true
@@ -405,6 +411,7 @@ def init_ivars # :nodoc:
405
411
@encoding = Encoding ::UTF_8
406
412
@charset = @encoding . name
407
413
@skip_tests = true
414
+ @apply_default_exclude = true
408
415
end
409
416
410
417
def init_with map # :nodoc:
@@ -430,6 +437,7 @@ def init_with map # :nodoc:
430
437
@title = map [ 'title' ]
431
438
@visibility = map [ 'visibility' ]
432
439
@webcvs = map [ 'webcvs' ]
440
+ @apply_default_exclude = map [ 'apply_default_exclude' ]
433
441
434
442
@rdoc_include = sanitize_path map [ 'rdoc_include' ]
435
443
@static_path = sanitize_path map [ 'static_path' ]
@@ -463,6 +471,7 @@ def override map # :nodoc:
463
471
@title = map [ 'title' ] if map . has_key? ( 'title' )
464
472
@visibility = map [ 'visibility' ] if map . has_key? ( 'visibility' )
465
473
@webcvs = map [ 'webcvs' ] if map . has_key? ( 'webcvs' )
474
+ @apply_default_exclude = map [ 'apply_default_exclude' ] if map . has_key? ( 'apply_default_exclude' )
466
475
467
476
@warn_missing_rdoc_ref = map [ 'warn_missing_rdoc_ref' ] if map . has_key? ( 'warn_missing_rdoc_ref' )
468
477
@@ -493,7 +502,8 @@ def == other # :nodoc:
493
502
@template == other . template and
494
503
@title == other . title and
495
504
@visibility == other . visibility and
496
- @webcvs == other . webcvs
505
+ @webcvs == other . webcvs and
506
+ @apply_default_exclude == other . apply_default_exclude
497
507
end
498
508
499
509
##
@@ -564,10 +574,12 @@ def exclude
564
574
if @exclude . nil? or Regexp === @exclude then
565
575
# done, #finish is being re-run
566
576
@exclude
567
- elsif @exclude . empty? then
577
+ elsif ! @apply_default_exclude and @exclude . empty? then
568
578
nil
569
579
else
570
- Regexp . new ( @exclude . join ( "|" ) )
580
+ exclude = @exclude
581
+ exclude |= DEFAULT_EXCLUDE if @apply_default_exclude
582
+ Regexp . new ( exclude . join ( "|" ) )
571
583
end
572
584
end
573
585
@@ -801,6 +813,11 @@ def parse argv
801
813
@exclude << value
802
814
end
803
815
816
+ opt . on ( "--[no-]apply-default-exclude" ,
817
+ "Use default PATTERN to exclude." ) do |value |
818
+ @apply_default_exclude = value
819
+ end
820
+
804
821
opt . separator nil
805
822
806
823
opt . on ( "--no-skipping-tests" , nil ,
0 commit comments