Skip to content

Commit

Permalink
Rubocop fixes
Browse files Browse the repository at this point in the history
Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
  • Loading branch information
addersuk committed Jan 9, 2023
1 parent 1a5c58d commit 9514fa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rulezilla/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def mandatory_attributes
def apply(record = {})
result_node = trace(record).last

result_node.nil? ? nil : result_node.result(record_klass_instance(record))
result_node&.result(record_klass_instance(record))
end

def all(record = {})
validate_missing_attributes(record)
result_node = tree.find_all(record_klass_instance(record))

result_node.nil? ? nil : result_node.map { |node| node.result(record_klass_instance(record)) }
result_node&.map { |node| node.result(record_klass_instance(record)) }
end

def results(record = nil)
Expand Down

0 comments on commit 9514fa5

Please sign in to comment.