Sha256: 4ba6c3736a8032badba87033134e9db3b8eb186a1ab01b98034a344e0705eb37
Contents?: true
Size: 1.11 KB
Versions: 11
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module RuboCop module AST # A node extension for `send` nodes. This will be used in place of a plain # node when the builder constructs the AST, making its methods available # to all `send` nodes within RuboCop. class SendNode < Node include ParameterizedNode include MethodDispatchNode ARROW = '->'.freeze # Checks whether this is a negation method, i.e. `!` or keyword `not`. # # @return [Boolean] whether this method is a negation method def negation_method? keyword_bang? || keyword_not? end # Checks whether this is a lambda. Some versions of parser parses # non-literal lambdas as a method send. # # @return [Boolean] whether this method is a lambda def lambda? parent && parent.block_type? && method?(:lambda) end # Checks whether this is a stabby lambda. e.g. `-> () {}` # # @return [Boolean] whether this method is a staby lambda def stabby_lambda? selector = loc.selector selector && selector.source == ARROW end end end end
Version data entries
11 entries across 11 versions & 2 rubygems