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>



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

def excluded
  @excluded
end

#yard_filesArray<String>



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



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