Class: LibRubyParser::Nodes::Case
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::Case
- Defined in:
- lib/lib-ruby-parser/nodes.rb
Overview
Represents a case statement (for pattern matching see CaseMatch 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")forcase 1; endNonefor code like. -
#expression_l ⇒ Loc
readonly
Location of the full expression.
-
#keyword_l ⇒ Loc
readonly
Location of the
casekeyword. -
#when_bodies ⇒ ::Array<Node>
readonly
A list of
Whennodes (each haspatternsandbody).
Instance Attribute Details
#else_body ⇒ Node? (readonly)
Body of the else branch, None if there's no else branch
512 513 514 |
# File 'lib/lib-ruby-parser/nodes.rb', line 512 def else_body @else_body end |
#else_l ⇒ Loc? (readonly)
Location of the else keyword
case 1; else; end
~~~~
None if there's no else branch
532 533 534 |
# File 'lib/lib-ruby-parser/nodes.rb', line 532 def else_l @else_l end |
#end_l ⇒ Loc (readonly)
Location of the end keyword
case 1; end
~~~
541 542 543 |
# File 'lib/lib-ruby-parser/nodes.rb', line 541 def end_l @end_l end |
#expr ⇒ Node? (readonly)
Expression given to case, Int("1") for case 1; end
None for code like
case
when pattern
end
504 505 506 |
# File 'lib/lib-ruby-parser/nodes.rb', line 504 def expr @expr end |
#expression_l ⇒ Loc (readonly)
Location of the full expression
case 1; end
~~~~~~~~~~~
550 551 552 |
# File 'lib/lib-ruby-parser/nodes.rb', line 550 def expression_l @expression_l end |
#keyword_l ⇒ Loc (readonly)
Location of the case keyword
case 1; end
~~~~
521 522 523 |
# File 'lib/lib-ruby-parser/nodes.rb', line 521 def keyword_l @keyword_l end |
#when_bodies ⇒ ::Array<Node> (readonly)
A list of When nodes (each has patterns and body)
508 509 510 |
# File 'lib/lib-ruby-parser/nodes.rb', line 508 def when_bodies @when_bodies end |