class Point
attr_accessor :x
attr_accessor :y
def initialize(*args)
init_methd_name = "_init_#{args.size}"
send(init_methd_name, *args)
end
protected
def _init_1(coordinates)
_init_2(coordinates[:x], coordinates[:y])
end
def _init_2(x, y)
raise "Error..." if (x < 0 || y < 0)
@x = x
@y = y
end
end
Created
February 7, 2013 23:11
-
-
Save behrangsa/4735081 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment