Intersection method of a Line.

Gives wrong result in the following case.
a = Ray(Point(0,0),Point(0,4))
b = Ray(Point(0,1),Point(0,-1))
a.intersection(b) 
Ray(Point(0,0),Point(0,4))
But the result should be 
Segment(Point(0,0),Point(0,1))