Skip to content

Commit

Permalink
Fix regex pattern in Header.parse to remove redundency and simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Swasey committed May 9, 2012
1 parent ca16e1d commit 31fcd15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/simple_oauth/header.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.decode(value)
end end


def self.parse(header) 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+)\=\"([^\"]*)\"$/) match = pair.match(/^(\w+)\=\"([^\"]*)\"$/)
attributes.merge(match[1].sub(/^oauth_/, '').to_sym => decode(match[2])) attributes.merge(match[1].sub(/^oauth_/, '').to_sym => decode(match[2]))
end end
Expand Down

0 comments on commit 31fcd15

Please sign in to comment.