Module: Rubyzen::Providers::EnclosingBlocksProvider

Included in:
Declarations::CallSiteDeclaration
Defined in:
lib/rubyzen/providers/enclosing_blocks_provider.rb

Overview

Provides the chain of blocks (do..end / { }) that lexically enclose a declaration, innermost first.

Instance Method Summary collapse

Instance Method Details

#enclosing_blocksRubyzen::Collections::BlocksCollection



7
8
9
10
11
12
13
# File 'lib/rubyzen/providers/enclosing_blocks_provider.rb', line 7

def enclosing_blocks
  Collections::BlocksCollection.new(
    node.each_ancestor(:block).map do |block_node|
      Declarations::BlockDeclaration.new(block_node, parent)
    end
  )
end