class Yoda::Parsing::NodeObjects::SendNode

Attributes

node[R]

Public Class Methods

new(node) click to toggle source

@param node [::Parser::AST::Node]

# File lib/yoda/parsing/node_objects/send_node.rb, line 8
def initialize(node)
  fail ArgumentError, node unless node.is_a?(::Parser::AST::Node)
  @node = node
end

Public Instance Methods

dot_range() click to toggle source

@return [Range, nil]

# File lib/yoda/parsing/node_objects/send_node.rb, line 45
def dot_range
  @dot_range ||= node.location.dot && Range.of_ast_location(node.location.dot)
end
next_location_to_dot() click to toggle source

@return [Location, nil]

# File lib/yoda/parsing/node_objects/send_node.rb, line 50
def next_location_to_dot
  node.location.dot && Range.of_ast_location(node.location.dot).end_location
end
offset_in_selector(location) click to toggle source

@param location [Location] @return Integer

# File lib/yoda/parsing/node_objects/send_node.rb, line 66
def offset_in_selector(location)
  location.offset_from_begin(node.location.selector)[:column]
end
on_dot?(location) click to toggle source

@param location [Location] @return [true, false]

# File lib/yoda/parsing/node_objects/send_node.rb, line 20
def on_dot?(location)
  node.location.dot ? dot_range.include?(location) : false
end
on_parameter?(location) click to toggle source

@param location [Location] @return [true, false]

# File lib/yoda/parsing/node_objects/send_node.rb, line 26
def on_parameter?(location)
  parameter_range.include?(location)
end
on_selector?(location) click to toggle source

@return [true, false]

# File lib/yoda/parsing/node_objects/send_node.rb, line 14
def on_selector?(location)
  node.location.selector ? selector_range.include?(location) : false
end
parameter_range() click to toggle source

@return [Range]

# File lib/yoda/parsing/node_objects/send_node.rb, line 31
def parameter_range
  @parameter_range ||=
    Range.new(
      Location.of_ast_location(node.location.selector.end),
      Location.of_ast_location(node.location.expression.end).move(row: 0, column: -1),
    )
end
receiver_node() click to toggle source

@return [Parser::AST::Node, nil]

# File lib/yoda/parsing/node_objects/send_node.rb, line 55
def receiver_node
  node && node.children[0]
end
selector_name() click to toggle source

@return [String]

# File lib/yoda/parsing/node_objects/send_node.rb, line 60
def selector_name
  node.children[1].to_s
end
selector_range() click to toggle source

@return [Range]

# File lib/yoda/parsing/node_objects/send_node.rb, line 40
def selector_range
  @selector_range ||= Range.of_ast_location(node.location.selector)
end