lib/rubocop/ast/node/if_node.rb in rubocop-ast-0.2.0 vs lib/rubocop/ast/node/if_node.rb in rubocop-ast-0.3.0
- old
+ new
@@ -145,26 +145,24 @@
#
# @return [Array<Node>] an array of branch nodes
def branches
branches = [if_branch]
- return branches unless else_branch
+ return branches unless else?
other_branches = if elsif_conditional?
else_branch.branches
else
[else_branch]
end
branches.concat(other_branches)
end
# @deprecated Use `branches.each`
- def each_branch
+ def each_branch(&block)
return branches.to_enum(__method__) unless block_given?
- branches.each do |branch|
- yield branch
- end
+ branches.each(&block)
end
end
end
end