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

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

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



255
# File 'lib/reek/ast/sexp_extensions.rb', line 255

def argslist() self[2] end

#bodyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



257
258
259
# File 'lib/reek/ast/sexp_extensions.rb', line 257

def body
  self[3]
end

#depends_on_instance?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


266
267
268
# File 'lib/reek/ast/sexp_extensions.rb', line 266

def depends_on_instance?
  ReferenceCollector.new(self).num_refs_to_self > 0
end

#full_name(outer) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



261
262
263
264
# File 'lib/reek/ast/sexp_extensions.rb', line 261

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

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



254
# File 'lib/reek/ast/sexp_extensions.rb', line 254

def name() self[1] end

#singleton_method?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


270
271
272
273
# File 'lib/reek/ast/sexp_extensions.rb', line 270

def singleton_method?
  # This catches the case where methods are defined within the "class << self" syntax.
  parent.type == :sclass if parent
end