Harold Hausman
10/5/2007 12:27:00 AM
On 10/4/07, Harnish Botadra <harnish_544@yahoo.com> wrote:
> Instead of doing,
>
> resultset = A.get_arr
> result = resultset[0].my_obj
>
>
> Can I combine the 2 statements into 1 when I know that my A.get_arr is
> sure to return an array with just 1 object.
>
I think your code could just become:
result = A.get_arr[0].my_obj
Consider this:
irb(main):002:0> def foo; ["foo"]; end
=> nil
irb(main):003:0> foo[0].reverse
=> "oof"
Hope that helps,
-Harold