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

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

Overview

Metadata for send nodes

Constant Summary collapse

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

Instance Method Summary collapse

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)

73
74
75
# File 'lib/mutant/ast/meta.rb', line 73

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)

83
84
85
# File 'lib/mutant/ast/meta.rb', line 83

def attribute_assignment?
  arguments.one? && attribute_assignment_selector?
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)

103
104
105
# File 'lib/mutant/ast/meta.rb', line 103

def binary_method_operator?
  arguments.one? && 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)

93
94
95
# File 'lib/mutant/ast/meta.rb', line 93

def index_assignment?
  arguments.length.equal?(2) && index_assignment_selector?
end