Class: YARD::Parser::Ruby::ParameterNode

Inherits:
AstNode show all
Defined in:
lib/yard/parser/ruby/ast_node.rb

Managing node state collapse

Constructor Details

This class inherits a constructor from YARD::Parser::Ruby::AstNode

Instance Method Details

#block_paramObject



382
# File 'lib/yard/parser/ruby/ast_node.rb', line 382

def block_param; self[-1] ? self[-1][0] : nil end

#keyword_paramObject



390
# File 'lib/yard/parser/ruby/ast_node.rb', line 390

def keyword_param; YARD.ruby2? ? self[-2] : nil end

#optional_paramsObject



383
384
385
386
387
388
389
# File 'lib/yard/parser/ruby/ast_node.rb', line 383

def optional_params
  optional = self[1] || []
  if self[-3] && self[-3][0] && self[-3][0].type == :default_arg
    optional += self[-3]
  end
  optional.empty? ? nil : optional
end

#required_end_paramsObject



380
# File 'lib/yard/parser/ruby/ast_node.rb', line 380

def required_end_params; self[3] end

#required_paramsObject



379
# File 'lib/yard/parser/ruby/ast_node.rb', line 379

def required_params; self[0] end

#splat_paramObject



381
# File 'lib/yard/parser/ruby/ast_node.rb', line 381

def splat_param; self[2] ? self[2][0] : nil end