J
James Byrne
I have this situation arising in a single class:
method 1 contains:
. .
current_hash = remap_current_hash( ao_hash )
puts( "I have returned from remap_current_hash" )
puts( "and now @current_hash contains:" )
puts( @current_hash.to_yaml.sort )
. .
method remap_current_hash contains
def remap_current_hash( hash )
@current_hash = case
when hash.has_key?( :ao_cctn )
remap_ao_hash( hash )
when hash.has_key?( :rr_cctn )
remap_rr_hash( hash )
when hash.has_key?( :rs_cctn )
remap_rs_hash( hash )
else
hash
end
puts( "I am returning from remap_current_hash" )
puts( "@current_hash is: " )
puts( @current_hash.to_yaml.sort )
puts()
return @current_hash
end
before the return in remap @current_hash looks like this:
@current_hash is:
- 7507PARS003936
---
:ccdns:
:cctn: "13466600016385"
:cfia_facsimile_no: " "
:cfia_telephone_no: " "
:dollar_value_total: "00000000030736"
:entry_type_code: AB
:expected_at: "201006101300"
. . .
immediately after the return it looks like this:
I have returned from remap_current_hash
and now @current_hash contains:
--- "13466600016294"
Before the return, @current_hash is a hash. After the return it is a
string with a totally unexpected value. There is absolutely no
intermediate processing that I can do between the method return and the
local variable. What is happening here? What is doing this?
method 1 contains:
. .
current_hash = remap_current_hash( ao_hash )
puts( "I have returned from remap_current_hash" )
puts( "and now @current_hash contains:" )
puts( @current_hash.to_yaml.sort )
. .
method remap_current_hash contains
def remap_current_hash( hash )
@current_hash = case
when hash.has_key?( :ao_cctn )
remap_ao_hash( hash )
when hash.has_key?( :rr_cctn )
remap_rr_hash( hash )
when hash.has_key?( :rs_cctn )
remap_rs_hash( hash )
else
hash
end
puts( "I am returning from remap_current_hash" )
puts( "@current_hash is: " )
puts( @current_hash.to_yaml.sort )
puts()
return @current_hash
end
before the return in remap @current_hash looks like this:
@current_hash is:
- 7507PARS003936
---
:ccdns:
:cctn: "13466600016385"
:cfia_facsimile_no: " "
:cfia_telephone_no: " "
:dollar_value_total: "00000000030736"
:entry_type_code: AB
:expected_at: "201006101300"
. . .
immediately after the return it looks like this:
I have returned from remap_current_hash
and now @current_hash contains:
--- "13466600016294"
Before the return, @current_hash is a hash. After the return it is a
string with a totally unexpected value. There is absolutely no
intermediate processing that I can do between the method return and the
local variable. What is happening here? What is doing this?