I want to learn the Ruy Lopez

there is also this
after blacks king castles, whites bishop is no use on the b5 square so it has to go back because it might get attacked by blacks queenside pawns
Of all my Ruy Lopez books, I like Leonard Barden's little book from 1963 best. You can find a used copy for about 2$. It gives just enough to play it and explains the ideas so you aren't lost after move 10. I'd suggest starting with it. Then I'd suggest play through the Ruy games from Fischer's book and some of Bronstein's 200 open games. [Bronstein enjoyed playing odd sidelines, like early d4 lines. If you like those games it would narrow what you study a lot.] After those the water gets deep fast and the amount of material starts to be overwhelming. IMO it then starts to be necessary to specialize [narrow the lines you play]. - Just my opinion and I expect to be still 'learning the Ruy Lopez' for many more years.
Of all my Ruy Lopez books, I like Leonard Barden's little book from 1963 best. You can find a used copy for about 2$. It gives just enough to play it and explains the ideas so you aren't lost after move 10. I'd suggest starting with it. Then I'd suggest play through the Ruy games from Fischer's book and some of Bronstein's 200 open games. [Bronstein enjoyed playing odd sidelines, like early d4 lines. If you like those games it would narrow what you study a lot.] After those the water gets deep fast and the amount of material starts to be overwhelming. IMO it then starts to be necessary to specialize [narrow the lines you play]. - Just my opinion and I expect to be still 'learning the Ruy Lopez' for many more years.
Great advice! Also one should study the Berlin Variation. It is almost a "drawing line" for many Grandmasters.

If you can find an affordable copy of "Mastering the Spanish" by Daniel King and Pietro Ponzetto, you won't be disappointed. It's a little 1994 book that's out of print, along with the rest of the "Mastering the..." series. Each chapter discusses a different pawn center that can come from the Ruy Lopez, showing the strategical ideas, plans, typical maneuvers, and tactical themes.
Unfortunately, the least expensive copy I can find with a quick search of used book sites is $55. I'm not familiar with the Barden book mentioned by @SwimmerBill, but unless you are very serious player it would probably be a better value. In addition to the Fischer and Bronstein games that he mentioned, you should take a look at the games of Paul Keres: the Ruy was his most commonly played opening against 1. e4, well over 200 times in his career.

If you can find an affordable copy of "Mastering the Spanish" by Daniel King and Pietro Ponzetto, you won't be disappointed. It's a little 1994 book that's out of print, along with the rest of the "Mastering the..." series. Each chapter discusses a different pawn center that can come from the Ruy Lopez, showing the strategical ideas, plans, typical maneuvers, and tactical themes.
Unfortunately, the least expensive copy I can find with a quick search of used book sites is $55. I'm not familiar with the Barden book mentioned by @SwimmerBill, but unless you are very serious player it would probably be a better value. In addition to the Fischer and Bronstein games that he mentioned, you should take a look at the games of Paul Keres: the Ruy was his most commonly played opening against 1. e4, well over 200 times in his career.
I was about to recommend that book as well. Even though it is dated, i think it is one of the best books you can find if you're serious about learning the Spanish.

Best to learn slightly offbeat variations for both Black and White, to cut down on the work. There are many interesting ones. For White against the the mainline, I like 5.d3, which allows you to play in classic Spanish style without learning complex variations. (Also it's amazing how often players of Black forget that they now need to do something about the threat to the e pawn!) For Black the Cozio looks interesting, though I haven't tried it
"... I found [The Ruy Lopez: Move by Move by GM Neil McDonald] to be informative and instructive, and enjoyed reading it. For players who wish to adopt the Ruy Lopez as white, ..." - FM Carsten Hansen (2012)
https://web.archive.org/web/20140627022042/http://www.chesscafe.com/text/hansen153.pdf
"... If you want to learn the basics of this interesting opening, there isn't a better book [than Starting Out: Ruy Lopez by IM John Shaw] on the market right now. ..." - FM Carsten Hansen (2003)
https://web.archive.org/web/20140627024240/http://www.chesscafe.com/text/hansen53.pdf

It took me 7 hours to learn all the Ruy Lopez theory in every named variation

Yes, Mastering the Spanish.
And also, I think this is not said enough... look at a lot of GM games. First from the past, then current ones. It doesn't matter if you don't understand them, the point isn't to understand every move. Just play over 1 or 2 games a day at a fast pace. Maybe 20 minutes total. Chessgames.com is free and has tons of games.
So this is totally painless, and after you've seen a few 100 games you'll have some good intuition about the middlegames (which is the whole point of the opening moves).
To a large extent, The Ruy Lopez: Move by Move by GM Neil McDonald and Starting Out: Ruy Lopez by IM John Shaw are collections of Ruy Lopez games.