From: Joel Pearson Date: 2013-02-06T06:05:23+09:00 Subject: Re: using an instance variable inside a method $ = global @@ = class @ = instance Ruby is clever enough to figure out that you mean self.price (using the attr_accessor for @price) when you state "price" in the method. Of course, you could create a local variable called "price" within that code which would temporarily override the reference. For example, modifying the class: class BookInStock def price_in_cents price = 1 Integer(price*100 + 0.5) end end > book.price => 33.8 > puts "Price in cents = #{book.price_in_cents}" Price in cents = 100 => nil > book.price => 33.8 -- Posted via http://www.ruby-forum.com/.