class YardJunk::Janitor::YardOptions
Allows to properly parse `.yardopts` or other option file YARD supports and gracefully replace or remove some of options.
Attributes
extra_files[R]
files[R]
options[R]
Public Class Methods
new()
click to toggle source
# File lib/yard-junk/janitor/yard_options.rb, line 10 def initialize internal = Internal.new internal.parse_arguments @options = internal.option_args @files = internal.files @extra_files = internal.options.files end
Public Instance Methods
remove_option(long, short = nil)
click to toggle source
# File lib/yard-junk/janitor/yard_options.rb, line 24 def remove_option(long, short = nil) [short, long].compact.each do |o| i = @options.index(o) next unless i @options.delete_at(i) @options.delete_at(i) unless @options[i].start_with?('-') # it was argument end self end
set_files(*files)
click to toggle source
# File lib/yard-junk/janitor/yard_options.rb, line 18 def set_files(*files) # rubocop:disable Naming/AccessorMethodName # TODO: REALLY fragile :( @files, @extra_files = files.partition { |f| f =~ /\.(rb|c|cxx|cpp|rake)/ } self end
to_a()
click to toggle source
# File lib/yard-junk/janitor/yard_options.rb, line 35 def to_a (@options + @files) .tap { |res| res.concat(['-', *@extra_files]) unless @extra_files.empty? } end