Module: Inch::Language::Ruby::Provider::YARD

Defined in:
lib/inch/language/ruby/provider/yard.rb,
lib/inch/language/ruby/provider/yard/parser.rb,
lib/inch/language/ruby/provider/yard/object.rb,
lib/inch/language/ruby/provider/yard/docstring.rb,
lib/inch/language/ruby/provider/yard/object/base.rb,
lib/inch/language/ruby/provider/yard/nodoc_helper.rb,
lib/inch/language/ruby/provider/yard/object/root_object.rb,
lib/inch/language/ruby/provider/yard/object/class_object.rb,
lib/inch/language/ruby/provider/yard/object/module_object.rb,
lib/inch/language/ruby/provider/yard/object/method_object.rb,
lib/inch/language/ruby/provider/yard/object/constant_object.rb,
lib/inch/language/ruby/provider/yard/object/namespace_object.rb,
lib/inch/language/ruby/provider/yard/object/method_signature.rb,
lib/inch/language/ruby/provider/yard/object/class_variable_object.rb,
lib/inch/language/ruby/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/language/ruby/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/language/ruby/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) ⇒ Object

See Also:

  • Provider.parse


41
42
43
# File 'lib/inch/language/ruby/provider/yard.rb', line 41

def self.parse(dir, config)
  Parser.parse(dir, config)
end