Class: LibRubyParser::Nodes::CaseMatch
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::CaseMatch
- Defined in:
- lib/lib-ruby-parser/nodes.rb
Overview
Represents a case statement used for pattern matching (for regular case see Case node)
Instance Attribute Summary collapse
-
#else_body ⇒ Node?
readonly
Body of the
elsebranch,Noneif there’s noelsebranch. -
#else_l ⇒ Loc?
readonly
Location of the
elsekeyword. -
#end_l ⇒ Loc
readonly
Location of the
endkeyword. -
#expr ⇒ Node
readonly
Expression given to
case, ‘Int(“1”)` for `case 1; in 1; end`Nonefor code like. -
#expression_l ⇒ Loc
readonly
Location of the full expression.
-
#in_bodies ⇒ ::Array<Node>
readonly
A list of
InPatternnodes (each haspattern,guardandbody). -
#keyword_l ⇒ Loc
readonly
Location of the
casekeyword.
Instance Attribute Details
#else_body ⇒ Node? (readonly)
Body of the else branch, None if there’s no else branch
573 574 575 |
# File 'lib/lib-ruby-parser/nodes.rb', line 573 def else_body @else_body end |
#else_l ⇒ Loc? (readonly)
Location of the else keyword
“‘text case 1; in 2; else; end
~~~~
“‘
None if there’s no else branch
593 594 595 |
# File 'lib/lib-ruby-parser/nodes.rb', line 593 def else_l @else_l end |
#end_l ⇒ Loc (readonly)
Location of the end keyword
“‘text case 1; in 2; end
~~~
“‘
602 603 604 |
# File 'lib/lib-ruby-parser/nodes.rb', line 602 def end_l @end_l end |
#expr ⇒ Node (readonly)
Expression given to case, ‘Int(“1”)` for `case 1; in 1; end` None for code like
“‘text case in pattern end “`
565 566 567 |
# File 'lib/lib-ruby-parser/nodes.rb', line 565 def expr @expr end |
#expression_l ⇒ Loc (readonly)
Location of the full expression
“‘text case 1; in 2; end ~~~~~~~~~~~~~~~~~ “`
611 612 613 |
# File 'lib/lib-ruby-parser/nodes.rb', line 611 def expression_l @expression_l end |
#in_bodies ⇒ ::Array<Node> (readonly)
A list of InPattern nodes (each has pattern, guard and body)
569 570 571 |
# File 'lib/lib-ruby-parser/nodes.rb', line 569 def in_bodies @in_bodies end |
#keyword_l ⇒ Loc (readonly)
Location of the case keyword
“‘text case 1; in 2; end ~~~~ “`
582 583 584 |
# File 'lib/lib-ruby-parser/nodes.rb', line 582 def keyword_l @keyword_l end |