Checking old emails on the matter, I like this approach a lot:
If you have different ways of constructing objects of a class, create
different class methods to do so. For example:
class MyClass
def self.from_x_y(x,y)
MyClass.new(x,y)
end
def self.default
MyClass.new(0,0)
end
def self.from_point(p)
MyClass.new(p.x, p.y)
end
def initialize(x,y)
@x = x
@y = y
end
end
This way you can have:
MyClass.default #=> 0,0
MyClass.from_x_y(10,20) # => 10,20
MyClass.from_point(Point.new(1,2)) #=> 1,2
Hope this helps,
Jesus.