Module: Reek::Source::SexpExtensions::MethodNodeBase

Included in:
DefNode, DefsNode
Defined in:
lib/reek/source/sexp_extensions.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#arg_namesObject


185
186
187
# File 'lib/reek/source/sexp_extensions.rb', line 185

def arg_names
  arguments.map(&:name)
end

#argumentsObject


181
182
183
# File 'lib/reek/source/sexp_extensions.rb', line 181

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

#body_nodes(types, ignoring = []) ⇒ Object


205
206
207
208
209
210
211
# File 'lib/reek/source/sexp_extensions.rb', line 205

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

#ends_with_bang?Boolean


201
202
203
# File 'lib/reek/source/sexp_extensions.rb', line 201

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

#name_without_bangObject


197
198
199
# File 'lib/reek/source/sexp_extensions.rb', line 197

def name_without_bang
  name.to_s.chop
end

#parameter_namesObject


193
194
195
# File 'lib/reek/source/sexp_extensions.rb', line 193

def parameter_names
  parameters.map(&:name)
end

#parametersObject


189
190
191
# File 'lib/reek/source/sexp_extensions.rb', line 189

def parameters
  argslist.children
end