Value as variable

a = “first”

b = “last”

i want to do

my_array.a
or
my_array.b

how would i do this?

instead of doing but to get the same result

my_array.frist
my_array.last

my_array.send(a)
or
my_array.send(b)

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #4 coming soon!
http://sensei.zenunit.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs