Skip to content

Commit e4f42dd

Browse files
committed
Replace use of == [] with .empty? predicate.
1 parent a600763 commit e4f42dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/json/ld/compact.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def compact(element, property: nil)
125125
next
126126
end
127127

128-
if expanded_value == []
128+
if expanded_value.empty?
129129
item_active_property =
130130
context.compact_iri(expanded_property,
131131
value: expanded_value,

lib/json/ld/frame.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ def value_match?(pattern, value)
520520
v2, t2, l2 = Array(pattern['@value']), Array(pattern['@type']), Array(pattern['@language'])
521521
return true if (v2 + t2 + l2).empty?
522522
return false unless v2.include?(v1) || v2 == [{}]
523-
return false unless t2.include?(t1) || t1 && t2 == [{}] || t1.nil? && (t2 || []) == []
524-
return false unless l2.include?(l1) || l1 && l2 == [{}] || l1.nil? && (l2 || []) == []
523+
return false unless t2.include?(t1) || t1 && t2 == [{}] || t1.nil? && (t2 || []).empty?
524+
return false unless l2.include?(l1) || l1 && l2 == [{}] || l1.nil? && (l2 || []).empty?
525525
true
526526
end
527527
end

0 commit comments

Comments
 (0)