Module: ImproveYourCode::AST::SexpExtensions::MethodNodeBase
Overview
Base module for utility methods for :def and :defs nodes.
Instance Method Summary collapse
- #arg_names ⇒ Object
- #arguments ⇒ 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/improve_your_code/ast/sexp_extensions/methods.rb', line 12 def arg_names arguments.map(&:name) end |
#arguments ⇒ Object
8 9 10 |
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 8 def arguments parameters.reject(&:block?) end |
#ends_with_bang? ⇒ Boolean
28 29 30 |
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 28 def ends_with_bang? name[-1] == '!' end |
#name_without_bang ⇒ Object
24 25 26 |
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 24 def name_without_bang name.to_s.chop end |
#parameter_names ⇒ Object
20 21 22 |
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 20 def parameter_names parameters.map(&:name) end |
#parameters ⇒ Object
16 17 18 |
# File 'lib/improve_your_code/ast/sexp_extensions/methods.rb', line 16 def parameters argslist.components end |