def extract_blocks(block)

      return {} unless block

      source = block.to_raw_source
      tree = Ruote.parse_ruby(source)

      multi =
        tree[0, 3] == [ :iter, [ :call, nil, :proc, [ :arglist ] ], nil ] &&
        tree[3].is_a?(Array) &&
        tree[3].first == :block &&
        tree[3][1..-1].all? { |e|
          e[0] == :iter &&
          e[2] == nil &&
          e[1][0, 2] == [ :call, nil ] &&
          e[1][3] == [ :arglist ]
        }

      if multi
        bpc = BlockParticipantContext.new
        bpc.instance_eval(&block)
        bpc.blocks
      else
        { 'on_workitem' => source }
      end
    end
def extract_blocks(block)

      return {} unless block

      source = block.to_raw_source
      tree = Ruote.parse_ruby(source)

      multi =
        tree[0, 3] == [ :iter, [ :call, nil, :proc, [ :arglist ] ], nil ] &&
        tree[3].is_a?(Array) &&
        tree[3].first == :block &&
        tree[3][1..-1].all? { |e|
          e[0] == :iter &&
          e[2] == nil &&
          e[1][0, 2] == [ :call, nil ] &&
          e[1][3] == [ :arglist ]
        }

      if multi
        bpc = BlockParticipantContext.new
        bpc.instance_eval(&block)
        bpc.blocks
      else
        { 'on_workitem' => source }
      end
    end
If the given block is nil, will return {}, else tries to determine
 if it's a single "on_workitem" block or a block that has sub-blocks,
 like in

   dashboard.register 'toto' do
     on_workitem do
       puts "hey I'm toto"
     end
     accept? do
       workitem.fields.length > 3
     end
   end