Class: Hashira::Duplication::Harvest

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(project, trees) ⇒ Harvest

Returns a new instance of Harvest.



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

def initialize(project, trees)
  @project = project
  @trees = trees
end

Instance Method Details

#fragmentsObject



13
# File 'lib/hashira/duplication/harvest.rb', line 13

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