以下是设置:
xml.search
返回一个节点集(多个值),我循环使用.each do |l|
langHash = hash with lots of 2 lette language codes 'en', 'fr' etc..
我想做的就是让XXXXXXXXXXXX评价为'英语','法语'
但是当我放置时:
xml.search('Language').each do |l|
code = "#{l.xpath('LanguageCode')}" # => 'en', 'fr' etc..
language = langHash[code.to_sym]
raise language.to_s # => 'English', 'French'
this_e=seeker.experiences.build(
:title => XXXXXXXXXXXX,
:of_type => 'skill'
)
this_e.save
this_e.shards.build(
:description => "#{l.children.first.attr('description')}: #{l.children.text}; last used: #{l.attr('lastUsed')}",
:experience_type => 'skill'
).save!
end
XXXXXXXXXX的值我试过了:
"#{language}" # => interning empty string
"#{l.xpath('LanguageCode')}" # => interning empty string
我希望我能正确解释这一点。