Skip to content

Commit

Permalink
only renormalize when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
SidOfc committed Apr 19, 2017
1 parent ee743ff commit 4e08a0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/browserino/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ def self.analyze(user_agent, identity = nil)
props = normalize props
props = with_smart_matchers props
left = props.select { |_, val| val.is_a? Regexp }
props = props.merge normalize(collect(left, user_agent))
props = props.merge normalize(collect(left, user_agent)) if left.any?
props = with_labels props
like = parse user_agent.gsub identity.pattern, '' if like

Client.new props, like
end

Expand Down

0 comments on commit 4e08a0c

Please sign in to comment.