Hi, all.
I’m attempting to learn Ruby & I’m using Apress’s “Beginning Ruby”.
The very first code example he gives in the book to run in Irb throws an
error:
$ irb 1.9.3-p362 :001 > class Person 1.9.3-p362 :002?> attr_accessor :name, :age, :gender 1.9.3-p362 :003?> end => nil 1.9.3-p362 :004 > person_instance.name = "Robert" NameError: undefined local variable or method
person_instance’ for
main:Object
from (irb):4
from /Users/dobbin/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in
<main>'
which it appears it’s complaining about the local variable that’s been
assigned.
I’ve tried this with Ruby 1.9.3 & 2.1.0 but it’s the same error.
Any help appreciated.
Cheers,
Phil…