It is possible, hypothetically, to do some strange things with metaprogramming:
class Point ... def location_at_value(x, y) x = Object.new x.define_method(:=) { |value| @value[x, y] = value } return x end end
Please note that I have not tested this, but it should work theoretically. This does not work, see comment below.
source share