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 each_when

Deprecated:
  • Use `when_branches.each`
def each_when
  return when_branches.to_enum(__method__) unless block_given?
  when_branches.each do |condition|
    yield condition
  end
  self
end

def else?

Returns:
  • (Boolean) - whether the `case` statement has an `else` branch
def else?
  loc.else
end

def else_branch

Returns:
  • (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

Returns:
  • (String) - the keyword of the `case` statement
def keyword
  'case'
end

def when_branches

Returns:
  • (Array) - an array of `when` nodes
def when_branches
  node_parts[1...-1]
end