From: "Kumar R." Date: 2013-03-02T04:39:38+09:00 Subject: Does `self` and `scope(local)` operate parallels? I am heavily confused with the topic when thinking `self` and `local scope` together. It seems they worked in parallel. To understand the same I tried the below code one with `self` : >> class Foo >> puts "#{self}" >> class Bar >> puts "#{self}" >> end >> def show >> puts "#{self}" >> end >> end Foo Foo::Bar => nil >> foo = Foo.new => # >> foo.show # => nil >> And the other with `local scope` as below: >> class Foo >> a = 5 >> class Bar >> a=2 >> def show >> a=11 >> p "show :: #{a}" >> end >> p "Bar :: #{a}" >> end >> p "Foo :: #{a}" >> end "Bar :: 2" "Foo :: 5" => "Foo :: 5" >> bar = Foo::Bar.new => # >> bar.show "show :: 11" => "show :: 11" >> But still not clear to me. Could anyone help me a solid example which would prove/show - if they operate parallel or not? -- Posted via http://www.ruby-forum.com/.