Module: ImproveYourCode::AST::SexpExtensions::ArgNodeBase

Included in:
ArgNode, BlockargNode, KwargNode, KwoptargNode, KwrestargNode, OptargNode, RestargNode, ShadowargNode
Defined in:
lib/improve_your_code/ast/sexp_extensions/arguments.rb

Instance Method Summary collapse

Instance Method Details

#anonymous_splat?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 27

def anonymous_splat?
  false
end

#block?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 19

def block?
  false
end

#componentsObject



31
32
33
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 31

def components
  [self]
end

#marked_unused?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 11

def marked_unused?
  plain_name.start_with?('_')
end

#nameObject



7
8
9
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 7

def name
  children.first
end

#optional_argument?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 23

def optional_argument?
  false
end

#plain_nameObject



15
16
17
# File 'lib/improve_your_code/ast/sexp_extensions/arguments.rb', line 15

def plain_name
  name.to_s
end