Module: RubyLint::MethodEvaluation

Included in:
Analysis::Base, VirtualMachine
Defined in:
lib/ruby-lint/method_evaluation.rb

Overview

Mixin that provides helper methods for handling method calls.

Instance Method Summary collapse

Instance Method Details

#unpack_block(node) ⇒ RubyLint::AST::Node

Given a (block) node this method returns the nested (send) node. If the supplied node is not a block it is returned directly.

This method is mostly useful for dealing with method calls that take a block. In these cases the AST is in the form of (block (send)) instead of (send (block)).

Parameters:

Returns:



17
18
19
# File 'lib/ruby-lint/method_evaluation.rb', line 17

def unpack_block(node)
  return node && node.block? ? node.children[0] : node
end