Class: Rucoa::Nodes::CaseNode

Inherits:
Base
  • Object
show all
Defined in:
lib/rucoa/nodes/case_node.rb

Instance Method Summary collapse

Methods inherited from Base

#ancestors, #child_nodes, #descendant_nodes, #each_ancestor, #each_child_node, #each_descendant_node, #include_position?, #initialize, #module_nesting, #namespace, #next_sibling_nodes, #parent, #parent=, #previous_sibling_nodes, #updated

Constructor Details

This class inherits a constructor from Rucoa::Nodes::Base

Instance Method Details

#whensArray<Rucoa::Nodes::Base>

Examples:

returns when nodes

node = Rucoa::Source.new(
  content: <<~RUBY,
    case foo
    when 1
    when 2
    else
    end
  RUBY
  uri: 'file:///foo.rb'
).root_node
expect(node.whens.length).to eq(2)

Returns:



19
20
21
# File 'lib/rucoa/nodes/case_node.rb', line 19

def whens
  children[1...-1]
end