lib/rcoli/utils.rb in rcoli-0.5.10 vs lib/rcoli/utils.rb in rcoli-0.5.11
- old
+ new
@@ -59,10 +59,10 @@
cmnd = @commands[command.to_s]
if cmnd
cmnd.scan(/\$\{([^\s]+)\}/).each do |s|
context = args[0]
(s[0].split('.').each{|key| context = (context.is_a? Hash) ? context[key] : nil})
- cmnd = cmnd.sub("${#{s[0]}}", context.to_s) if context
+ cmnd = cmnd.sub("${#{s[0]}}", ((context.is_a? Array) ? context.join(',') : context.to_s)) if context
end
# ALTERNATIVE SOLUTION
# cmnd.to_enum(:scan, /\$\{([^\s]+)\}/).map {[Regexp.last_match[0], Regexp.last_match[1].split('.')]}.each do |m|
# context = (context.nil? ? config : context)[m[1].delete_at(0)] until m[1].size == 0