Generic hooks with callbacks for Ruby.