Module: Inch::CLI::YardoptsHelper

Included in:
Command::Options::Base
Defined in:
lib/inch/cli/yardopts_helper.rb

Defined Under Namespace

Classes: YardoptsWrapper

Constant Summary collapse

VALID_YARD_SWITCHES =
%w(--private --no-private --protected --no-public
--plugin --load --safe --yardopts --no-yardopts --document --no-document)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#excludedArray<String>

Returns list of excluded paths (regexp matches).

Returns:

  • (Array<String>)

    list of excluded paths (regexp matches)



8
9
10
# File 'lib/inch/cli/yardopts_helper.rb', line 8

def excluded
  @excluded
end

#yard_filesArray<String>

Returns list of Ruby source files to process.

Returns:

  • (Array<String>)

    list of Ruby source files to process



5
6
7
# File 'lib/inch/cli/yardopts_helper.rb', line 5

def yard_files
  @yard_files
end

Instance Method Details

#parse_yardopts_options(opts, args) ⇒ void

This method returns an undefined value.

Parses the option and gracefully handles invalid switches

Parameters:

  • opts (OptionParser)

    the option parser object

  • args (Array<String>)

    the arguments passed from input. This array will be modified.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/inch/cli/yardopts_helper.rb', line 19

def parse_yardopts_options(opts, args)
  wrapper = YardoptsWrapper.new()

  dupped_args = args.dup
  dupped_args.delete("--help")
  dupped_args.delete_if do |arg|
    arg =~ /^\-/ && !VALID_YARD_SWITCHES.include?(arg)
  end

  ui.debug "Sending args to YARD:\n" \
        "  args: #{dupped_args}"

  wrapper.parse_arguments(*dupped_args)

  self.yard_files = wrapper.files
  self.excluded = wrapper.excluded
end

#yardopts_options(opts) ⇒ Object



37
38
39
40
# File 'lib/inch/cli/yardopts_helper.rb', line 37

def yardopts_options(opts)
  wrapper = YardoptsWrapper.new()
  wrapper.add_yardoc_options(opts)
end