class RuboCop::AST::CaseNode
to all ‘case` nodes within RuboCop.
node when the builder constructs the AST, making its methods available
A node extension for `case` nodes. This will be used in place of a plain
def branches
-
(Array
- an array of the bodies of the when branches)
def branches bodies = when_branches.map(&:body) bodies.push(else_branch) if else? bodies end
def each_when(&block)
- Use `when_branches.each`
def each_when(&block) return when_branches.to_enum(__method__) unless block when_branches.each(&block) self end
def else?
-
(Boolean)
- whether the `case` statement has an `else` branch
def else? loc.else end
def else_branch
-
(nil)
- if the case statement does not have an else branch. -
(Node)
- the else branch node of the `case` statement
def else_branch node_parts[-1] end
def keyword
-
(String)
- the keyword of the `case` statement
def keyword 'case' end
def when_branches
-
(Array
- an array of `when` nodes)
def when_branches node_parts[1...-1] end