Class: Mutant::AST::Meta::Send

Inherits:
Object
  • Object
show all
Includes:
NamedChildren
Defined in:
lib/mutant/ast/meta/send.rb

Overview

Metadata for send nodes

Constant Summary collapse

INDEX_ASSIGNMENT_SELECTOR =
:[]=
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX =
'='.freeze

Instance Method Summary collapse

Methods included from NamedChildren

included

Instance Method Details

#assignment?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if AST node is a valid assignment target

Returns:

  • (Boolean)


27
28
29
# File 'lib/mutant/ast/meta/send.rb', line 27

def assignment?
  index_assignment? || attribute_assignment?
end

#attribute_assignment?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if AST node is an attribute assignment?

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/mutant/ast/meta/send.rb', line 36

def attribute_assignment?
  !Types::METHOD_OPERATORS.include?(selector) &&
  selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
end

#binary_method_operator?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test for binary operator implemented as method

Returns:

  • (Boolean)


55
56
57
# File 'lib/mutant/ast/meta/send.rb', line 55

def binary_method_operator?
  Types::BINARY_METHOD_OPERATORS.include?(selector)
end

#index_assignment?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if AST node is an index assign

Returns:

  • (Boolean)


46
47
48
# File 'lib/mutant/ast/meta/send.rb', line 46

def index_assignment?
  selector.equal?(INDEX_ASSIGNMENT_SELECTOR)
end