Abinoam Jr. wrote in post #1122322:
> Could you repeat the test using the code bellow?
>
> My point is, without the wrap=true the modification of @doc instance
> variable inside "so.rb"
> propagates back to the test.br context.
>
> so.rb
> ======
> require 'nokogiri'
>
> @doc = Nokogiri::HTML.parse("<div>foo</div>")
> puts "Inside so.rb"
> p @doc
>
>
> test.rb
> =======
> @doc = "doc is Just a String as an 'original' value"
> puts "Inside test.rb before load"
> p @doc #=> It renders that String
>
> load "./so.rb", true
> puts "Inside test.rb after load with the wrap=true option"
> p @doc #=> Still rendering a String
>
> load "./so.rb"
> puts "Inside test.rb after load"
> p @doc #=> Now, without the wrap=true, your @doc points to a
> Nokogiri::HTML::Document
> # Because it was set this way "inside" called file "so.rb".

I did the test...

kirti@kirti-Aspire-5733Z:~/ruby$ ruby test.rb
Inside test.rb before load
"doc is Just a String as an 'original' value"
Inside so.rb
#<Nokogiri::HTML::Document:0x44e72f4 name="document"
children=[#<Nokogiri::XML::DTD:0x44e71c8 name="html">,
#<Nokogiri::XML::Element:0x44e709c name="html"
children=[#<Nokogiri::XML::Element:0x44e6f5c name="body"
children=[#<Nokogiri::XML::Element:0x44e6dae name="div"
children=[#<Nokogiri::XML::Text:0x44e6b6a "foo">]>]>]>]>
Inside test.rb after load with the wrap=true option
"doc is Just a String as an 'original' value"
Inside so.rb
#<Nokogiri::HTML::Document:0x44e628c name="document"
children=[#<Nokogiri::XML::DTD:0x44e614c name="html">,
#<Nokogiri::XML::Element:0x459ffe8 name="html"
children=[#<Nokogiri::XML::Element:0x459fef8 name="body"
children=[#<Nokogiri::XML::Element:0x459fe08 name="div"
children=[#<Nokogiri::XML::Text:0x459fd18 "foo">]>]>]>]>
Inside test.rb after load
#<Nokogiri::HTML::Document:0x44e628c name="document"
children=[#<Nokogiri::XML::DTD:0x44e614c name="html">,
#<Nokogiri::XML::Element:0x459ffe8 name="html"
children=[#<Nokogiri::XML::Element:0x459fef8 name="body"
children=[#<Nokogiri::XML::Element:0x459fe08 name="div"
children=[#<Nokogiri::XML::Text:0x459fd18 "foo">]>]>]>]>
kirti@kirti-Aspire-5733Z:~/ruby$

-- 
Posted via http://www.ruby-forum.com/.