Sha256: e4345e686caeca5893d7f5069bec515f93d7756ff3d679567525f4e7555d20fc

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

module Reek
  module AST
    module SexpExtensions
      # Utility methods for :if nodes.
      module IfNode
        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

1 entries across 1 versions & 1 rubygems

Version Path
reek-5.0.2 lib/reek/ast/sexp_extensions/if.rb