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.



10
11
12
13
# File 'lib/hashira/duplication/extractor.rb', line 10

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

Instance Attribute Details

#fragmentsObject (readonly)

Returns the value of attribute fragments.



15
16
17
# File 'lib/hashira/duplication/extractor.rb', line 15

def fragments
  @fragments
end