Module: Inch::CodeObject::Provider::YARD

Defined in:
lib/inch/code_object/provider/yard.rb,
lib/inch/code_object/provider/yard/object.rb,
lib/inch/code_object/provider/yard/parser.rb,
lib/inch/code_object/provider/yard/docstring.rb,
lib/inch/code_object/provider/yard/object/base.rb,
lib/inch/code_object/provider/yard/nodoc_helper.rb,
lib/inch/code_object/provider/yard/object/root_object.rb,
lib/inch/code_object/provider/yard/object/class_object.rb,
lib/inch/code_object/provider/yard/object/method_object.rb,
lib/inch/code_object/provider/yard/object/module_object.rb,
lib/inch/code_object/provider/yard/object/constant_object.rb,
lib/inch/code_object/provider/yard/object/method_signature.rb,
lib/inch/code_object/provider/yard/object/namespace_object.rb,
lib/inch/code_object/provider/yard/object/method_parameter_object.rb

Overview

Parses the source tree (using YARD)

Defined Under Namespace

Modules: NodocHelper, Object Classes: Docstring, Parser

Class Method Summary collapse

Class Method Details

.implicit_docstring?(docstring, method) ⇒ Boolean

Returns true if the docstring was generated by YARD

Parameters:

  • docstring (Docstring, String)
  • method (MethodObject)

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/inch/code_object/provider/yard.rb', line 11

def self.implicit_docstring?(docstring, method)
  name = method.name
  if method.getter?
    docstring.to_s == "Returns the value of attribute #{name}"
  elsif method.setter?
    basename = name.to_s.gsub(/(\=)$/, '')
    docstring.to_s == "Sets the attribute #{basename}"
  else
    false
  end
end

.implicit_tag?(tag, method) ⇒ Boolean

Returns true if the tag was generated by YARD

Parameters:

  • tag (::YARD::Tag)
  • method (MethodObject)

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/inch/code_object/provider/yard.rb', line 27

def self.implicit_tag?(tag, method)
  name = method.name
  if method.getter?
    tag.tag_name == 'return' &&
      tag.text == "the current value of #{name}"
  elsif method.setter?
    tag.tag_name == 'return' &&
      tag.text == 'the newly set value'
  else
    false
  end
end

.parse(dir, config = Inch::Config.codebase) ⇒ Object



40
41
42
# File 'lib/inch/code_object/provider/yard.rb', line 40

def self.parse(dir, config = Inch::Config.codebase)
  Parser.parse(dir, config)
end