Hi Richard, You definitely missed a couple of important topics about OOP and encapsulation in particular.
Take a look on attribute accessors in Java (as example), so you could understand how it work in ruby and what attr_accessor key word does. This guy has a nice explanation (cannot say it about his english, so you can look for similar guide in Spanish) https://www.youtube.com/watch?v=VOR-uQCCbcw You need more practice and at least one good book about the way ruby works, because without any background you will be thinking that the whole mess you can find in Ruby is the right way to do things. Think about an example below: class Auto attr_accessor :auto01, :auto02 def initialize(auto01,auto02) @auto01 = auto01 @auto02 = auto02 end def calcular_neto auto01 = 1 # what will happend here? what are local variables? puts auto01 # why have I used "@" symbol. Why is it needed puts @auto01 puts auto02 # Would be result the same if I changed auto01 to @auto01 (auto01 + auto02)*0.18 + auto01 + auto02 end # think about this one. Why it has get prefix? # why do we need return? What does ruby return and when? # Is there a difference between "@" and "self"? # what will be the result? def get_neto return (@auto01 + @auto02)*0.18 + self.auto01 + self.auto02 end end Check it out please, and post here further questions -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/13090099cfa179610af2076d45957677%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.