James Coglan
1/19/2009 3:27:00 PM
[Note: parts of this message were removed to make it a legal post.]
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().
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
# calls foo_object.bar_method
foo_object :bar_method
It might be helpful if we knew the problem you're trying to solve -- can you
give us any more info?