Go buy a piece of ready rod(threaded rod) maybe 4 inches longer than the width of your ramp, drill through all the pieces of 2x4.
For each separate side of your ramp put (in this order)starting from the inside, 2 nuts tightened together so they lock & won't loosen, this is shortened up cause I type with 1 finger.
NN,W,2,W,2,W,2,W,NN. Make the middle 2x4 the leg, do that for each side.
If you do it this way, you will be able to fold it all up to the length of the longest section of the ramp. If you wanted too?
If whatever doesn't kill you, only makes you stronger.
Then I am so close to immortality