Class: Deadlyzer::ConstantLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/deadlyzer/constant_loader.rb

Defined Under Namespace

Classes: Constant

Constant Summary collapse

CURRENT_DIRECTORY =
File.expand_path('.', __dir__)
DEFAULT_PATTERN =
'/**/*.rb'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory: nil, excluded_dirs: nil, excluded_consts: nil, pattern: nil) ⇒ ConstantLoader

Returns a new instance of ConstantLoader.



37
38
39
40
41
42
43
44
45
# File 'lib/deadlyzer/constant_loader.rb', line 37

def initialize(directory: nil, excluded_dirs: nil, excluded_consts: nil, pattern: nil)
  @directory       = directory
  @excluded_dirs   = excluded_dirs || []
  @excluded_consts = excluded_consts || []
  @pattern         = pattern       || DEFAULT_PATTERN
  @ast             = []
  @constants       = []
  @empty_files     = []
end

Instance Attribute Details

#astObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



35
36
37
# File 'lib/deadlyzer/constant_loader.rb', line 35

def ast
  @ast
end

#directoryObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



11
12
13
# File 'lib/deadlyzer/constant_loader.rb', line 11

def directory
  @directory
end

#empty_filesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



19
20
21
# File 'lib/deadlyzer/constant_loader.rb', line 19

def empty_files
  @empty_files
end

#excludeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



27
28
29
# File 'lib/deadlyzer/constant_loader.rb', line 27

def exclude
  @exclude
end

#excluded_constsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



23
24
25
# File 'lib/deadlyzer/constant_loader.rb', line 23

def excluded_consts
  @excluded_consts
end

#excluded_dirsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



15
16
17
# File 'lib/deadlyzer/constant_loader.rb', line 15

def excluded_dirs
  @excluded_dirs
end

#patternObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



31
32
33
# File 'lib/deadlyzer/constant_loader.rb', line 31

def pattern
  @pattern
end

Instance Method Details

#constantsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



49
50
51
52
53
54
# File 'lib/deadlyzer/constant_loader.rb', line 49

def constants
  load_ast!
  load_matcher!
  load_constants!
  @constants
end