Module: Reek::AST::SexpExtensions::MethodNodeBase Private

Included in:
DefNode, DefsNode
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.

Base module for utility methods for :def and :defs nodes.

Instance Method Summary collapse

Instance Method Details

#arg_namesObject

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.



223
224
225
# File 'lib/reek/ast/sexp_extensions.rb', line 223

def arg_names
  arguments.map(&:name)
end

#argumentsObject

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.



219
220
221
# File 'lib/reek/ast/sexp_extensions.rb', line 219

def arguments
  parameters.reject(&:block?)
end

#body_nodes(types, ignoring = []) ⇒ 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.



243
244
245
246
247
248
249
# File 'lib/reek/ast/sexp_extensions.rb', line 243

def body_nodes(types, ignoring = [])
  if body
    body.find_nodes(types, ignoring)
  else
    []
  end
end

#ends_with_bang?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)


239
240
241
# File 'lib/reek/ast/sexp_extensions.rb', line 239

def ends_with_bang?
  name[-1] == '!'
end

#name_without_bangObject

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.



235
236
237
# File 'lib/reek/ast/sexp_extensions.rb', line 235

def name_without_bang
  name.to_s.chop
end

#parameter_namesObject

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.



231
232
233
# File 'lib/reek/ast/sexp_extensions.rb', line 231

def parameter_names
  parameters.map(&:name)
end

#parametersObject

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.



227
228
229
# File 'lib/reek/ast/sexp_extensions.rb', line 227

def parameters
  argslist.components
end