Class: JsDependency::SourceAnalysis::Leave

Inherits:
Object
  • Object
show all
Defined in:
lib/js_dependency/source_analysis/leave.rb

Overview

Components have no dependencies.

Instance Method Summary collapse

Constructor Details

#initialize(index, src_path) ⇒ Leave

Returns a new instance of Leave.

Parameters:

  • index (Hash)
  • src_path (String)


10
11
12
13
# File 'lib/js_dependency/source_analysis/leave.rb', line 10

def initialize(index, src_path)
  @index = index
  @src_path = src_path
end

Instance Method Details

#callArray<String>

Returns:

  • (Array<String>)


16
17
18
19
20
21
22
23
24
25
# File 'lib/js_dependency/source_analysis/leave.rb', line 16

def call
  left_index = @index.filter do |_target_path, child_paths|
    blank?(child_paths)
  end

  left_index = left_index.transform_keys do |target_path|
    relative_path_or_external_path(target_path, @src_path)
  end
  left_index.keys.uniq.sort
end