Skip to content

Commit

Permalink
Improve readability for #entity
Browse files Browse the repository at this point in the history
* Early return if there is no `entities`
* Early return if there is no match for `reference` in `entities`

Co-Authored-By: NAITOH Jun <naitoh@gmail.com>
  • Loading branch information
vikiv480 and naitoh committed Aug 16, 2024
1 parent 6555c27 commit 60632a5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/rexml/parsers/baseparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,13 @@ def pull_event
private :pull_event

def entity( reference, entities )
value = nil
value = entities[ reference ] if entities
if value
record_entity_expansion
return unnormalize( value, entities )
end
return unless entities

value = entities[ reference ]
return if value.nil?

nil
record_entity_expansion
unnormalize( value, entities )
end

# Escapes all possible entities
Expand Down

0 comments on commit 60632a5

Please sign in to comment.