Class: Contracts::Formatters::ParamsAST

Inherits:
Object
  • Object
show all
Defined in:
lib/yard-contracts/formatters.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ ParamsAST

Returns a new instance of ParamsAST


115
116
117
# File 'lib/yard-contracts/formatters.rb', line 115

def initialize(params)
  @params = params
end

Instance Method Details

#to_aObject


119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/yard-contracts/formatters.rb', line 119

def to_a
  params = []
  @params.each_with_index do |param, i|
    #YARD::Parser::Ruby::AstNode
    next if param.nil?
    if param.type == :list
      param.each do |p|
        next if p.nil?
        params << build_param_element(p)
      end
    else
      params << build_param_element(param)
    end
  end
  params
end