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:0x21f9ed0>
>> foo.show
#<Foo:0x21f9ed0>
=> 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
=> #<Foo::Bar:0x1f8d650>
>> 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/.