Class: YARP::RescueModifierNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::RescueModifierNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents an expression modified with a rescue.
foo rescue nil
^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
attr_reader expression: Node.
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_loc: Location.
-
#rescue_expression ⇒ Object
readonly
attr_reader rescue_expression: Node.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#copy(**params) ⇒ Object
def copy: (**params) -> RescueModifierNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(expression, keyword_loc, rescue_expression, location) ⇒ RescueModifierNode
constructor
def initialize: (expression: Node, keyword_loc: Location, rescue_expression: Node, location: Location) -> void.
-
#keyword ⇒ Object
def keyword: () -> String.
- #set_newline_flag(newline_marked) ⇒ Object
Constructor Details
#initialize(expression, keyword_loc, rescue_expression, location) ⇒ RescueModifierNode
def initialize: (expression: Node, keyword_loc: Location, rescue_expression: Node, location: Location) -> void
6582 6583 6584 6585 6586 6587 |
# File 'lib/yarp/node.rb', line 6582 def initialize(expression, keyword_loc, rescue_expression, location) @expression = expression @keyword_loc = keyword_loc @rescue_expression = rescue_expression @location = location end |
Instance Attribute Details
#expression ⇒ Object (readonly)
attr_reader expression: Node
6573 6574 6575 |
# File 'lib/yarp/node.rb', line 6573 def expression @expression end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
6576 6577 6578 |
# File 'lib/yarp/node.rb', line 6576 def keyword_loc @keyword_loc end |
#rescue_expression ⇒ Object (readonly)
attr_reader rescue_expression: Node
6579 6580 6581 |
# File 'lib/yarp/node.rb', line 6579 def rescue_expression @rescue_expression end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
6590 6591 6592 |
# File 'lib/yarp/node.rb', line 6590 def accept(visitor) visitor.visit_rescue_modifier_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6599 6600 6601 |
# File 'lib/yarp/node.rb', line 6599 def child_nodes [expression, rescue_expression] end |
#copy(**params) ⇒ Object
def copy: (**params) -> RescueModifierNode
6604 6605 6606 6607 6608 6609 6610 6611 |
# File 'lib/yarp/node.rb', line 6604 def copy(**params) RescueModifierNode.new( params.fetch(:expression) { expression }, params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:rescue_expression) { rescue_expression }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
6617 6618 6619 |
# File 'lib/yarp/node.rb', line 6617 def deconstruct_keys(keys) { expression: expression, keyword_loc: keyword_loc, rescue_expression: rescue_expression, location: location } end |
#keyword ⇒ Object
def keyword: () -> String
6622 6623 6624 |
# File 'lib/yarp/node.rb', line 6622 def keyword keyword_loc.slice end |
#set_newline_flag(newline_marked) ⇒ Object
6594 6595 6596 |
# File 'lib/yarp/node.rb', line 6594 def set_newline_flag(newline_marked) expression.set_newline_flag(newline_marked) end |