def search(object_to_search)
      object = object_to_search
      @instructions.each do |instruction|
        if instruction.first == :ret_if_match
          if object
            break # short-circuit or expression
          else
            object = object_to_search  # reset search
          end
        else
          object = send(instruction[0], object, instruction[1])
        end
      end

      object
    end
def search(object_to_search)
      object = object_to_search
      @instructions.each do |instruction|
        if instruction.first == :ret_if_match
          if object
            break # short-circuit or expression
          else
            object = object_to_search  # reset search
          end
        else
          object = send(instruction[0], object, instruction[1])
        end
      end

      object
    end
Creates a virtual machine that can evaluate a set of instructions.
 Use the {Parser} to turn an expression into a set of instructions.

 @param instructions [Array(Symbol, Object)] a list of instructions to
   execute.
 @see Parser#parse
 @example VM for expression "foo.bar[-1]"
   vm = VM.new [
    [:get_key, 'foo'],
    [:get_key, 'bar'],
    [:get_idx, -1]
   ]
   vm.search(foo: {bar: [1, 2, 3]}) #=> 3
 Searches for the compile expression against the object passed in.

 @param object_to_search [Object] the object to search for results.
 @return (see Jamespath.search)