Skip to content

Commit 3e780d9

Browse files
tompngnaitoh
andauthored
Apply suggestions from code review
Co-authored-by: NAITOH Jun <naitoh@gmail.com>
1 parent 5d35322 commit 3e780d9

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/rexml/doctype.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def attribute_of element, attribute
123123
_attlist_mappings[element]&.[](attribute)
124124
end
125125

126-
def _attlist_mappings
126+
def _attlist_mappings # :nodoc:
127127
mapping = {}
128128
grep(AttlistDecl).each do |child|
129129
raw_attributes = mapping[child.element_name] ||= {}

lib/rexml/element.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,8 @@ def _calculate_namespaces(attlist_mappings = nil) # :nodoc:
25232523
# the element's attribute takes precedence.
25242524
def each_effective_attribute(attlist_mappings = nil)
25252525
return to_enum(__method__, attlist_mappings) unless block_given?
2526-
attributes = attlist_attributes(attlist_mappings).merge(self)
2526+
attlist = attlist_attributes(attlist_mappings)
2527+
attributes = attlist.empty? ? self : attlist.merge(self)
25272528
attributes.each_value do |attribute|
25282529
yield attribute
25292530
end

0 commit comments

Comments
 (0)