Merge pull request #8 from endash/fix-space-in-header-bug

Fix regex pattern in Header.parse to remove redundency and simplify
This commit is contained in:
Steve Richert 2012-05-09 09:14:04 -07:00
commit f7124aba14

View file

@ -25,7 +25,7 @@ module SimpleOAuth
end
def self.parse(header)
header.to_s.sub(/^OAuth\s/, '').split(/,[\s\t]*/).inject({}) do |attributes, pair|
header.to_s.sub(/^OAuth\s/, '').split(/,\s*/).inject({}) do |attributes, pair|
match = pair.match(/^(\w+)\=\"([^\"]*)\"$/)
attributes.merge(match[1].sub(/^oauth_/, '').to_sym => decode(match[2]))
end