Skip to content

Commit

Permalink
chore: pr feedback; avoid mutating fn params
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilias Tsangaris committed Jan 5, 2022
1 parent 2729d32 commit e8e7c31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/ruby/lib/readme/har/request_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def url
headers = @request.headers
forward_proto = headers["X-Forwarded-Proto"]
forward_host = headers["X-Forwarded-Host"]
url.host = forward_host if forward_host.instance_of?(String)
url.scheme = forward_proto if forward_proto.instance_of?(String)
url.host = forward_host if forward_host.is_a?(String)
url.scheme = forward_proto if forward_proto.is_a?(String)
url.to_s
end

Expand Down
8 changes: 2 additions & 6 deletions packages/ruby/lib/readme/payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ class Payload

def initialize(har, info, development:)
@har = har
# swap api_key for id
info[:id] = info.delete :api_key unless info[:api_key].nil?
# pull log_id and ignore fields out of info to construct a user_info hash that can be assigned to the group key
@user_info = info.slice(:id, :label, :email)
@user_info[:id] = info[:api_key] unless info[:api_key].nil? # swap api_key for id if api_key is present
@log_id = info[:log_id]
@ignore = info[:ignore]
info.delete :log_id
info.delete :ignore
@user_info = info
@development = development
@uuid = UUID.new
end
Expand Down

0 comments on commit e8e7c31

Please sign in to comment.