Class: Inch::Language::Elixir::Provider::Reader::Parser

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

Overview

Parses the source tree (using Reader)

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



11
12
13
# File 'lib/inch/language/elixir/provider/reader/parser.rb', line 11

def parsed_objects
  @parsed_objects
end

Class Method Details

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

Helper method to parse an instance with the given args

See Also:



18
19
20
21
22
# File 'lib/inch/language/elixir/provider/reader/parser.rb', line 18

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

Instance Method Details

#objectsArray<YARD::Object::Base>



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/inch/language/elixir/provider/reader/parser.rb', line 35

def objects
  @objects ||= begin
    list = parsed_objects.map do |o|
      Reader::Object.for(o) # unless IGNORE_TYPES.include?(o.type)
    end.compact
    children_map = {}
    list.each do |object|
      if object.parent_fullname
        children_map[object.parent_fullname] ||= []
        children_map[object.parent_fullname] << object.fullname
      end
    end
    list.each do |object|
      object.children_fullnames = children_map[object.fullname]
    end
    list
  end
end

#parse(dir, config) ⇒ void



27
28
29
30
31
32
# File 'lib/inch/language/elixir/provider/reader/parser.rb', line 27

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