Class: Hashira::Duplication::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/duplication/extractor.rb

Constant Summary collapse

WHOLE =
[Prism::DefNode, Prism::WhenNode, Prism::RescueNode].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, trees) ⇒ Extractor

Returns a new instance of Extractor.



8
9
10
11
# File 'lib/hashira/duplication/extractor.rb', line 8

def initialize(project, trees)
  @project = project
  @fragments = trees.flat_map { |path, tree| scan(@project.relative(path), tree) }
end

Instance Attribute Details

#fragmentsObject (readonly)

Returns the value of attribute fragments.



13
14
15
# File 'lib/hashira/duplication/extractor.rb', line 13

def fragments
  @fragments
end