class SyntaxSuggest::AroundBlockScan

此类用于探索代码块之前和之后的内容

它在传入代码块的上方和下方搜索以匹配您给定的任何条件

示例

def dog         # 1
  puts "bark"   # 2
  puts "bark"   # 3
end             # 4

scan = AroundBlockScan.new(
  code_lines: code_lines
  block: CodeBlock.new(lines: code_lines[1])
)

scan.scan_while { true }

puts scan.before_index # => 0
puts scan.after_index  # => 3