Module: ImproveYourCode::AST::SexpExtensions::IfNode

Defined in:
lib/improve_your_code/ast/sexp_extensions/if.rb

Overview

Utility methods for :if nodes.

Instance Method Summary collapse

Instance Method Details

#body_nodes(type, ignoring = []) ⇒ Object



12
13
14
# File 'lib/improve_your_code/ast/sexp_extensions/if.rb', line 12

def body_nodes(type, ignoring = [])
  children[1..-1].compact.flat_map { |child| child.find_nodes(type, ignoring) }
end

#conditionObject



8
9
10
# File 'lib/improve_your_code/ast/sexp_extensions/if.rb', line 8

def condition
  children.first
end