Module: ImproveYourCode::AST::SexpExtensions::BlockNode
- Defined in:
- lib/improve_your_code/ast/sexp_extensions/block.rb
Overview
Utility methods for :block nodes.
Instance Method Summary collapse
- #args ⇒ Object
- #block ⇒ Object
- #call ⇒ Object
- #parameter_names ⇒ Object
- #parameters ⇒ Object
- #simple_name ⇒ Object
- #without_block_arguments? ⇒ Boolean
Instance Method Details
#args ⇒ Object
12 13 14 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 12 def args children[1] end |
#block ⇒ Object
16 17 18 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 16 def block children[2] end |
#call ⇒ Object
8 9 10 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 8 def call children.first end |
#parameter_names ⇒ Object
24 25 26 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 24 def parameter_names parameters.children end |
#parameters ⇒ Object
20 21 22 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 20 def parameters children[1] || [] end |
#simple_name ⇒ Object
28 29 30 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 28 def simple_name :block end |
#without_block_arguments? ⇒ Boolean
32 33 34 |
# File 'lib/improve_your_code/ast/sexp_extensions/block.rb', line 32 def without_block_arguments? args.components.empty? end |