Module: Reek::AST::SexpExtensions::DefNode

Includes:
MethodNodeBase
Defined in:
lib/reek/ast/sexp_extensions/methods.rb

Overview

Utility methods for :def nodes.

Instance Method Summary collapse

Methods included from MethodNodeBase

#arg_names, #arguments, #body_nodes, #ends_with_bang?, #name_without_bang, #parameter_names, #parameters

Instance Method Details

#argslistObject



48
49
50
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 48

def argslist
  children[1]
end

#bodyObject



52
53
54
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 52

def body
  children[2]
end

#depends_on_instance?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 60

def depends_on_instance?
  ReferenceCollector.new(self).num_refs_to_self.positive?
end

#full_name(outer) ⇒ Object



56
57
58
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 56

def full_name(outer)
  [outer, name].reject(&:empty?).join('#')
end

#nameObject



44
45
46
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 44

def name
  children.first
end