Sha256: 3d96e0108e3892cb68d060fd9a27c30cef4a39b8ceed934a65843cdec98c5896

Contents?: true

Size: 605 Bytes

Versions: 28

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true
module Reek
  module AST
    module SexpExtensions
      # Utility methods for :block nodes.
      module BlockNode
        def call
          children.first
        end

        def args
          children[1]
        end

        def block
          children[2]
        end

        def parameters
          children[1] || []
        end

        def parameter_names
          parameters.children
        end

        def simple_name
          :block
        end

        def without_block_arguments?
          args.components.empty?
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
reek-4.1.0 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.5 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.4 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.3 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.2 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.1 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.0 lib/reek/ast/sexp_extensions/block.rb
reek-4.0.0.pre1 lib/reek/ast/sexp_extensions/block.rb