Hi all,
This might sound a bit wierd but I would like to know if
there are any other ways of calling a method without using . operator or
calling send().
You could write a DSL that would make it look like you weren't doing dot or
send() but at some level you're going have to use one of those, or maybe
instance_eval. e.g.:
objects = {
:foo => foo_object
}
def method_missing(name, method)
objects[name.to_sym].__send__(method)
end
It might be helpful if we knew the problem you're trying to solve -- can you
give us any more info?
···
2009/1/19 ruby rails <bagam_venkat@hotmail.com>
Hi all,
This might sound a bit wierd but I would like to know if
there are any other ways of calling a method without using . operator or
calling send().
Hi all,
This might sound a bit wierd but I would like to know if
there are any other ways of calling a method without using . operator or
calling send().
Is it possible using blocks or something else?
Look Ma, no dots!
class Foo
def hello
puts "hello!"
end
end
eval "Foo\056new\056hello"
#=> hello!
I will send my contact info via email so that I may receive my prize.