class Prism::RequiredKeywordParameterNode

Represents a required keyword parameter to a method, block, or lambda definition.

def a(b: )
      ^^
end

Public Class Methods

new(source, node_id, location, flags, name, name_loc) click to toggle source

Initialize a new RequiredKeywordParameterNode node.

# File lib/prism/node.rb, line 26540
def initialize(source, node_id, location, flags, name, name_loc)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
  @name = name
  @name_loc = name_loc
end

Public Instance Methods

name → Symbol click to toggle source

Returns the name attribute.

# File lib/prism/node.rb, line 26649
def name
  @name
end

Flags

↑ top

Public Instance Methods

repeated_parameter?() click to toggle source

a parameter name that has been repeated in the method signature

# File lib/prism/node.rb, line 26639
def repeated_parameter?
  flags.anybits?(ParameterFlags::REPEATED_PARAMETER)
end

Locations

↑ top

Public Instance Methods

name_loc → Location click to toggle source

Returns the Location represented by name_loc.

# File lib/prism/node.rb, line 26660
def name_loc
  location = @name_loc
  return location if location.is_a?(Location)
  @name_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
end

Node Interface

↑ top

Public Class Methods

type() click to toggle source

See Node.type.

# File lib/prism/node.rb, line 26624
def self.type
  :required_keyword_parameter_node
end

Public Instance Methods

accept(visitor) click to toggle source

See Node.accept.

# File lib/prism/node.rb, line 26563
def accept(visitor)
  visitor.visit_required_keyword_parameter_node(self)
end
child_nodes() click to toggle source

See Node.child_nodes.

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

See Node.comment_targets.

# File lib/prism/node.rb, line 26593
def comment_targets
  [name_loc] #: Array[Prism::node | Location]
end
compact_child_nodes() click to toggle source

See Node.compact_child_nodes.

# File lib/prism/node.rb, line 26586
def compact_child_nodes
  []
end
copy(**fields) → RequiredKeywordParameterNode click to toggle source

Creates a copy of self with the given fields, using self as the template.

# File lib/prism/node.rb, line 26603
def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, name_loc: self.name_loc)
  RequiredKeywordParameterNode.new(source, node_id, location, flags, name, name_loc)
end
deconstruct()
Alias for: child_nodes
each_child_node(&blk) click to toggle source

See Node.each_child_node.

# File lib/prism/node.rb, line 26578
def each_child_node(&blk)
  return to_enum(:each_child_node) unless block_given?

end
type() click to toggle source

See Node#type.

# File lib/prism/node.rb, line 26617
def type
  :required_keyword_parameter_node
end

Repository

↑ top

Public Instance Methods

save_name_loc(repository) click to toggle source

Save the name_loc location using the given saved source so that it can be retrieved later.

# File lib/prism/node.rb, line 26671
def save_name_loc(repository)
  repository.enter(node_id, :name_loc)
end

Slicing

↑ top