Skip to content

Commit

Permalink
Ruby warning fix: instance variable used before initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
chaymaeBZ committed Jul 15, 2020
1 parent 5b1bb34 commit af896b0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/wasabi/parser.rb
Expand Up @@ -319,14 +319,13 @@ def section(section_name)
end

def sections
return @sections if @sections

sections = {}
document.root.element_children.each do |node|
(sections[node.name] ||= []) << node
end

@sections = sections
@sections ||= begin
sections = {}
document.root.element_children.each do |node|
(sections[node.name] ||= []) << node
end
sections
end
end
end
end

0 comments on commit af896b0

Please sign in to comment.