Class: Sexp

Inherits:
Object show all
Defined in:
lib/reek/code_parser.rb

Overview

Extensions to Sexp to allow CodeParser to navigate the abstract syntax tree more easily.

Instance Method Summary collapse

Instance Method Details

#childrenObject



17
18
19
# File 'lib/reek/code_parser.rb', line 17

def children
  find_all { |item| Sexp === item }
end

#has_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/reek/code_parser.rb', line 25

def has_type?(type)
  is_language_node? and first == type
end

#is_language_node?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/reek/code_parser.rb', line 21

def is_language_node?
  first.class == Symbol
end