Class: YARP::UndefNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::UndefNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘undef` keyword.
undef :foo, :bar, :baz
^^^^^^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_loc: Location.
-
#names ⇒ Object
readonly
attr_reader names: Array.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#copy(**params) ⇒ Object
def copy: (**params) -> UndefNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(names, keyword_loc, location) ⇒ UndefNode
constructor
def initialize: (names: Array, keyword_loc: Location, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
-
#keyword ⇒ Object
def keyword: () -> String.
Constructor Details
#initialize(names, keyword_loc, location) ⇒ UndefNode
def initialize: (names: Array, keyword_loc: Location, location: Location) -> void
9943 9944 9945 9946 9947 |
# File 'lib/yarp/node.rb', line 9943 def initialize(names, keyword_loc, location) @names = names @keyword_loc = keyword_loc @location = location end |
Instance Attribute Details
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
9940 9941 9942 |
# File 'lib/yarp/node.rb', line 9940 def keyword_loc @keyword_loc end |
#names ⇒ Object (readonly)
attr_reader names: Array
9937 9938 9939 |
# File 'lib/yarp/node.rb', line 9937 def names @names end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
9950 9951 9952 |
# File 'lib/yarp/node.rb', line 9950 def accept(visitor) visitor.visit_undef_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
9955 9956 9957 |
# File 'lib/yarp/node.rb', line 9955 def child_nodes [*names] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
9960 9961 9962 |
# File 'lib/yarp/node.rb', line 9960 def comment_targets [*names, keyword_loc] end |
#copy(**params) ⇒ Object
def copy: (**params) -> UndefNode
9965 9966 9967 9968 9969 9970 9971 |
# File 'lib/yarp/node.rb', line 9965 def copy(**params) UndefNode.new( params.fetch(:names) { names }, params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
9977 9978 9979 |
# File 'lib/yarp/node.rb', line 9977 def deconstruct_keys(keys) { names: names, keyword_loc: keyword_loc, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
9986 9987 9988 9989 9990 9991 |
# File 'lib/yarp/node.rb', line 9986 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── names: #{inspector.list("#{inspector.prefix}│ ", names)}" inspector << "└── keyword_loc: #{inspector.location(keyword_loc)}\n" inspector.to_str end |
#keyword ⇒ Object
def keyword: () -> String
9982 9983 9984 |
# File 'lib/yarp/node.rb', line 9982 def keyword keyword_loc.slice end |