Hello Ruby/REXML developers,
The implementation can be found here:
https://github.com/ruby/rexml/blob/7e4049f6a68c99c4efec2df117057ee080680c9f/lib/rexml/functions.rb#L265C1-L273C8
The current code is as follows:
# UNTESTED
def Functions::normalize_space( string=nil )
string = string(@@context[:node]) if string.nil?
if string.kind_of? Array
string.collect{|x| string.to_s.strip.gsub(/\s+/um, ' ') if string}
else
string.to_s.strip.gsub(/\s+/um, ' ')
end
end
It appears there may be a typo in the use of x versus string within the collect block. I believe the following adjustment might be more in line with the intended functionality:
string.collect{|x| x.to_s.strip.gsub(/\s+/um, ' ') if x}
I might be misunderstanding the intention here, so if I've overlooked something, please do let me know.
Thank you for your time.