class YARP::BreakNode

Represents the use of the ‘break` keyword.

break foo
^^^^^^^^^

Attributes

arguments[R]

attr_reader arguments: ArgumentsNode?

keyword_loc[R]

attr_reader keyword_loc: Location

Public Class Methods

new(arguments, keyword_loc, location) click to toggle source

def initialize: (arguments: ArgumentsNode?, keyword_loc: Location, location: Location) -> void

# File yarp/node.rb, line 1228
def initialize(arguments, keyword_loc, location)
  @arguments = arguments
  @keyword_loc = keyword_loc
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File yarp/node.rb, line 1235
def accept(visitor)
  visitor.visit_break_node(self)
end
child_nodes() click to toggle source

def child_nodes: () -> Array[nil | Node]

# File yarp/node.rb, line 1240
def child_nodes
  [arguments]
end
Also aliased as: deconstruct
comment_targets() click to toggle source

def comment_targets: () -> Array[Node | Location]

# File yarp/node.rb, line 1245
def comment_targets
  [*arguments, keyword_loc]
end
copy(**params) click to toggle source

def copy: (**params) -> BreakNode

# File yarp/node.rb, line 1250
def copy(**params)
  BreakNode.new(
    params.fetch(:arguments) { arguments },
    params.fetch(:keyword_loc) { keyword_loc },
    params.fetch(:location) { location },
  )
end
deconstruct()

def deconstruct: () -> Array[nil | Node]

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]

# File yarp/node.rb, line 1262
def deconstruct_keys(keys)
  { arguments: arguments, keyword_loc: keyword_loc, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 1271
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  if (arguments = self.arguments).nil?
    inspector << "├── arguments: ∅\n"
  else
    inspector << "├── arguments:\n"
    inspector << arguments.inspect(inspector.child_inspector("│   ")).delete_prefix(inspector.prefix)
  end
  inspector << "└── keyword_loc: #{inspector.location(keyword_loc)}\n"
  inspector.to_str
end
keyword() click to toggle source

def keyword: () -> String

# File yarp/node.rb, line 1267
def keyword
  keyword_loc.slice
end