Module: Reek::AST::SexpExtensions::MethodNodeBase
Overview
Base module for utility methods for :def and :defs nodes.
Instance Method Summary collapse
- #arg_names ⇒ Object
- #arguments ⇒ Object
- #body_nodes(types, ignoring = []) ⇒ Object
- #ends_with_bang? ⇒ Boolean
- #name_without_bang ⇒ Object
- #parameter_names ⇒ Object
- #parameters ⇒ Object
Instance Method Details
#arg_names ⇒ Object
12 13 14 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 12 def arg_names arguments.map(&:name) end |
#arguments ⇒ Object
8 9 10 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 8 def arguments parameters.reject(&:block?) end |
#body_nodes(types, ignoring = []) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 32 def body_nodes(types, ignoring = []) return [] unless body return [] if ignoring.include?(body.type) body.each_node(types, ignoring | types) end |
#ends_with_bang? ⇒ Boolean
28 29 30 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 28 def ends_with_bang? name[-1] == '!' end |
#name_without_bang ⇒ Object
24 25 26 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 24 def name_without_bang name.to_s.chop end |
#parameter_names ⇒ Object
20 21 22 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 20 def parameter_names parameters.map(&:name) end |
#parameters ⇒ Object
16 17 18 |
# File 'lib/reek/ast/sexp_extensions/methods.rb', line 16 def parameters argslist.components end |