From: Sarek Mather Date: 2013-05-06T19:03:47+09:00 Subject: Re: NoMethodError split for array using optional parameter Thanks robert. I'll spend some time thinking about what you wrote. When I learn about OOP, perhaps that will help, too. So you know, this is the method I 'ended up' with: def cookies(*args) #If a value is passed, it is added to cookies, else cookies are returned. $cookiesH = {} if $cookiesH == nil #adds cookies to cookies hash if (args[0] != nil) then if (args[0].is_a? Array) then c = args[0].join(";") else c = args[0].to_s end c.split(";").each {|e| e.match(/(.*)=(.*)/) key = $1.strip unless $1 == nil k = key.downcase unless $1 == nil if ($2 != nil and $1 != nil and k != "expires" and k != "max-age" and k != "domain" and k != "path") then $cookiesH[key]=$2 end } end #reports cookies in string format if (args[0] == nil) then cookies = $cookiesH.map{|k, v| "#{k}=#{v}"}.join("; ") return cookies end end -- Posted via http://www.ruby-forum.com/.