Sha256: f3bc61345c1d34d8fda22cc594c1b1aafbd943c63bf0302ee75e4a51bdd2bffc

Contents?: true

Size: 436 Bytes

Versions: 5

Compression:

Stored size: 436 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 { |child| child.find_nodes(type, ignoring) }
        end

        def else_body
          children.last
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reek-4.7.3 lib/reek/ast/sexp_extensions/case.rb
reek-4.7.2 lib/reek/ast/sexp_extensions/case.rb
reek-4.7.1 lib/reek/ast/sexp_extensions/case.rb
reek-4.7.0 lib/reek/ast/sexp_extensions/case.rb
reek-4.6.2 lib/reek/ast/sexp_extensions/case.rb