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
3048 3049 3050 3051 3052 3053 3054 |
# File 'lib/yarp/node.rb', line 3048 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
3042 3043 3044 |
# File 'lib/yarp/node.rb', line 3042 def in_loc @in_loc end |
#pattern ⇒ Object (readonly)
attr_reader pattern: Node
3036 3037 3038 |
# File 'lib/yarp/node.rb', line 3036 def pattern @pattern end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
3039 3040 3041 |
# File 'lib/yarp/node.rb', line 3039 def statements @statements end |
#then_loc ⇒ Object (readonly)
attr_reader then_loc: Location?
3045 3046 3047 |
# File 'lib/yarp/node.rb', line 3045 def then_loc @then_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3057 3058 3059 |
# File 'lib/yarp/node.rb', line 3057 def accept(visitor) visitor.visit_in_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3063 3064 3065 |
# File 'lib/yarp/node.rb', line 3063 def child_nodes [pattern, statements] end |
#deconstruct_keys(keys) ⇒ Object
3071 3072 3073 |
# File 'lib/yarp/node.rb', line 3071 def deconstruct_keys(keys) { pattern: pattern, statements: statements, in_loc: in_loc, then_loc: then_loc, location: location } end |
#in ⇒ Object
def in: () -> String
3076 3077 3078 |
# File 'lib/yarp/node.rb', line 3076 def in in_loc.slice end |
#then ⇒ Object
def then: () -> String?
3081 3082 3083 |
# File 'lib/yarp/node.rb', line 3081 def then then_loc&.slice end |