--f46d043c7d987b7f4a04ac120b99
Content-Type: text/plain; charset=ISO-8859-1

On Sat, Sep 3, 2011 at 6:31 PM, jack jones <shehio_22 / hotmail.com> wrote:

> Isn't there any other way to invoke shehio.array[index]  th ... Can
> this be achieved?
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
Yes, but not from instances of Whatever. You can fake out the object you
return from the array method


class Whatever

  # this class does nothing that real arrays don't already do, so...
  class FakeArray
    def initialize
      @real_array  ["apple", "banana", "peach"]
    end
    def []ndex, val)
      @real_array[index]  al
    end
    def [](index)
      @real_array
    end
  end

  attr_accessor :array
  def initialize
    @array  akeArray.new
  end

end


What are you trying to do that you think you need this capability?

--f46d043c7d987b7f4a04ac120b99--