class Tryouts::PrismParser
def classify_blocks(blocks)
def classify_blocks(blocks) blocks.map.with_index do |block, index| block_type = case block in { expectations: [] } if index == 0 :setup in { expectations: [] } if index == blocks.size - 1 :teardown in { expectations: Array => exps } if !exps.empty? :test else :preamble # Default fallback end block.merge(type: block_type, end_line: calculate_end_line(block)) end end