D
Daniel Schierbeck
Would this be possible:
class Klass
def self.[] (*args)
new(*args)
end
end
# these should do the same
Klass("foo", "bar") # new
Klass["foo", "bar"] # current
obj = proc { |a, b| puts a + b }
# these should do the same
obj("a", "b") # new
obj["a", "b"] # current
It does have some complications, but it is a way to make Proc's seem
like normal methods.
Just an idea
Daniel
class Klass
def self.[] (*args)
new(*args)
end
end
# these should do the same
Klass("foo", "bar") # new
Klass["foo", "bar"] # current
obj = proc { |a, b| puts a + b }
# these should do the same
obj("a", "b") # new
obj["a", "b"] # current
It does have some complications, but it is a way to make Proc's seem
like normal methods.
Just an idea
Daniel