Class: YARP::InNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::InNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘in` keyword in a case statement.
case a; in b then c end
^^^^^^^^^^^
Instance Attribute Summary collapse
-
#in_loc ⇒ Object
readonly
attr_reader in_loc: Location.
-
#pattern ⇒ Object
readonly
attr_reader pattern: Node.
-
#statements ⇒ Object
readonly
attr_reader statements: Node?.
-
#then_loc ⇒ Object
readonly
attr_reader then_loc: Location?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#in ⇒ Object
def in: () -> String.
-
#initialize(pattern, statements, in_loc, then_loc, location) ⇒ InNode
constructor
def initialize: (pattern: Node, statements: Node?, in_loc: Location, then_loc: Location?, location: Location) -> void.
-
#then ⇒ Object
def then: () -> String?.
Constructor Details
#initialize(pattern, statements, in_loc, then_loc, location) ⇒ InNode
def initialize: (pattern: Node, statements: Node?, in_loc: Location, then_loc: Location?, location: Location) -> void
3056 3057 3058 3059 3060 3061 3062 |
# File 'lib/yarp/node.rb', line 3056 def initialize(pattern, statements, in_loc, then_loc, location) @pattern = pattern @statements = statements @in_loc = in_loc @then_loc = then_loc @location = location end |
Instance Attribute Details
#in_loc ⇒ Object (readonly)
attr_reader in_loc: Location
3050 3051 3052 |
# File 'lib/yarp/node.rb', line 3050 def in_loc @in_loc end |
#pattern ⇒ Object (readonly)
attr_reader pattern: Node
3044 3045 3046 |
# File 'lib/yarp/node.rb', line 3044 def pattern @pattern end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
3047 3048 3049 |
# File 'lib/yarp/node.rb', line 3047 def statements @statements end |
#then_loc ⇒ Object (readonly)
attr_reader then_loc: Location?
3053 3054 3055 |
# File 'lib/yarp/node.rb', line 3053 def then_loc @then_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3065 3066 3067 |
# File 'lib/yarp/node.rb', line 3065 def accept(visitor) visitor.visit_in_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3070 3071 3072 |
# File 'lib/yarp/node.rb', line 3070 def child_nodes [pattern, statements] end |
#deconstruct_keys(keys) ⇒ Object
3078 3079 3080 |
# File 'lib/yarp/node.rb', line 3078 def deconstruct_keys(keys) { pattern: pattern, statements: statements, in_loc: in_loc, then_loc: then_loc, location: location } end |
#in ⇒ Object
def in: () -> String
3083 3084 3085 |
# File 'lib/yarp/node.rb', line 3083 def in in_loc.slice end |
#then ⇒ Object
def then: () -> String?
3088 3089 3090 |
# File 'lib/yarp/node.rb', line 3088 def then then_loc&.slice end |