Class: Cease::Eviction::Chunk
- Inherits:
-
Object
- Object
- Cease::Eviction::Chunk
- Extended by:
- Forwardable
- Defined in:
- lib/cease/eviction/chunk.rb
Instance Method Summary collapse
- #extract ⇒ Array<Parser::AST::Node>
-
#initialize(ast:, statement:) ⇒ Chunk
constructor
A new instance of Chunk.
Constructor Details
#initialize(ast:, statement:) ⇒ Chunk
Returns a new instance of Chunk.
10 11 12 13 14 15 |
# File 'lib/cease/eviction/chunk.rb', line 10 def initialize(ast:, statement:) @ast = ast @statement = statement @closest_parent = nil @children = [] end |
Instance Method Details
#extract ⇒ Array<Parser::AST::Node>
18 19 20 21 22 23 24 |
# File 'lib/cease/eviction/chunk.rb', line 18 def extract return ast if only_child? find_closest_parent(ast) find_children(closest_parent) children end |