Class: Inch::Language::Nodejs::Provider::JSDoc::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/language/nodejs/provider/jsdoc/parser.rb

Overview

Parses the source tree (using JSDoc)

Constant Summary collapse

IGNORE_TYPES =

TODO: should we remove constant and namespace from this list?

%w(member package constant namespace)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parsed_objectsObject (readonly)

Returns the value of attribute parsed_objects


14
15
16
# File 'lib/inch/language/nodejs/provider/jsdoc/parser.rb', line 14

def parsed_objects
  @parsed_objects
end

Class Method Details

.parse(*args) ⇒ CodeObject::Provider::JSDoc::Parser

Helper method to parse an instance with the given args

Returns:

  • (CodeObject::Provider::JSDoc::Parser)

    the instance that ran

See Also:


21
22
23
24
25
# File 'lib/inch/language/nodejs/provider/jsdoc/parser.rb', line 21

def self.parse(*args)
  parser = new
  parser.parse(*args)
  parser
end

Instance Method Details

#objectsArray<YARD::Object::Base>

Returns:

  • (Array<YARD::Object::Base>)

38
39
40
41
42
# File 'lib/inch/language/nodejs/provider/jsdoc/parser.rb', line 38

def objects
  @objects ||= parsed_objects.map do |o|
    JSDoc::Object.for(o) unless IGNORE_TYPES.include?(o['kind'])
  end.compact
end

#parse(dir, config) ⇒ void

This method returns an undefined value.

Parameters:


30
31
32
33
34
35
# File 'lib/inch/language/nodejs/provider/jsdoc/parser.rb', line 30

def parse(dir, config)
  Dir.chdir(dir) do
    parse_objects(config.included_files, config.excluded_files,
                  config.read_dump_file)
  end
end