class Prettyrb::Nodes::SendNode

Public Instance Methods

arguments() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 12
def arguments
  children[2..-1]
end
array_access?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 40
def array_access?
  children[1] == :[]
end
array_assignment?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 32
def array_assignment?
  children[1] == :[]=
end
called_on_heredoc?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 44
def called_on_heredoc?
  child = target

  while child&.type == :send || child&.string?
    return true if child.string? && child.heredoc?
    child = child.children[0]
    return false unless child.respond_to?(:type)
  end

  false
end
heredoc_arguments?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 56
def heredoc_arguments?
  arguments.any? do |child|
    child.string? && child.heredoc? || (child.type == :send && child.called_on_heredoc?)
  end
end
infix?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 20
def infix?
  !children[1].to_s.match?(/^[a-zA-Z_]/)
end
left_hand_mass_assignment?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 36
def left_hand_mass_assignment?
  parent&.type == :mlhs && method.to_s.end_with?("=")
end
method() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 8
def method
  children[1]
end
negate?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 28
def negate?
  children[1] == :!
end
negative?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 24
def negative?
  children[1] == :-@ && children[2].nil?
end
self_target?() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 16
def self_target?
  children[2].nil? && method.to_s.end_with?("@")
end
target() click to toggle source
# File lib/prettyrb/nodes/send_node.rb, line 4
def target
  children[0]
end