Module: ImproveYourCode::AST::SexpExtensions::DefsNode

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

Overview

Utility methods for :defs nodes.

Instance Method Summary collapse

Methods included from MethodNodeBase

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

Instance Method Details

#argslistObject



66
67
68
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 66

def argslist
  children[2]
end

#bodyObject



70
71
72
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 70

def body
  children[3]
end

#full_name(outer) ⇒ Object



74
75
76
77
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 74

def full_name(outer)
  prefix = outer == '' ? '' : "#{outer}#"
  "#{prefix}#{receiver.name}.#{name}"
end

#nameObject



62
63
64
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 62

def name
  children[1]
end

#receiverObject



58
59
60
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 58

def receiver
  children.first
end