Sha256: b561d5e5d0e2b2497e28056dc217d380ab8b8f3192fbcd994689abaa544cc908

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

module Reek
  module AST
    module SexpExtensions
      # Utility methods for :if nodes.
      module IfNode
        def condition
          children.first
        end

        # :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).to_a
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-4.8.2 lib/reek/ast/sexp_extensions/if.rb
reek-4.8.1 lib/reek/ast/sexp_extensions/if.rb
reek-4.8.0 lib/reek/ast/sexp_extensions/if.rb