Sha256: 6f2e01e786c1ca455640b5b100c6ebbb5a02237cade50e1bdd31315c2e84938f

Contents?: true

Size: 472 Bytes

Versions: 21

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

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

        def body_nodes(type, ignoring = [])
          children[1..-1].compact.flat_map do |child|
            child.each_node(type, ignoring | type).to_a
          end
        end

        def else_body
          children.last
        end
      end
    end
  end
end

Version data entries

21 entries across 19 versions & 2 rubygems

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