Sha256: 874f1ce1ad63fe35ba2c4cc1e61de0dc0753625177383d9cb119cb3850c8684a
Contents?: true
Size: 1.1 KB
Versions: 20
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Reek module AST module SexpExtensions # Utility methods for :if nodes. module IfNode # # @return [Reek::AST::Node] the condition that is associated with a conditional node. # For instance, this code # # if charlie(bravo) then delta end # # would be parsed into this AST: # # s(:if, # s(:send, nil, :charlie, # s(:lvar, :bravo)), # s(:send, nil, :delta), nil) # # so in this case we would return this # # s(:send, nil, :charlie, # s(:lvar, :bravo)) # # as condition. # def condition children.first end # @quality :reek:FeatureEnvy def body_nodes(type, ignoring = []) children[1..-1].compact.flat_map do |child| if ignoring.include? child.type [] else child.each_node(type, ignoring | type).to_a end end end end end end end
Version data entries
20 entries across 18 versions & 2 rubygems