Class: Solargraph::TypeChecker::ParamDef

Inherits:
Object
  • Object
show all
Defined in:
lib/solargraph/type_checker/param_def.rb

Overview

Data about a method parameter definition. This is the information from the args list in the def call, not the ‘@param` tags.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type) ⇒ ParamDef



17
18
19
20
# File 'lib/solargraph/type_checker/param_def.rb', line 17

def initialize name, type
  @name = name
  @type = type
end

Instance Attribute Details

#nameString (readonly)



10
11
12
# File 'lib/solargraph/type_checker/param_def.rb', line 10

def name
  @name
end

#typeSymbol (readonly)



13
14
15
# File 'lib/solargraph/type_checker/param_def.rb', line 13

def type
  @type
end

Class Method Details

.from(pin) ⇒ Array<ParamDef>

Get an array of ParamDefs from a method pin.



27
28
29
30
31
32
33
# File 'lib/solargraph/type_checker/param_def.rb', line 27

def from pin
  result = []
  pin.parameters.each do |par|
    result.push ParamDef.new(par.name, par.decl)
  end
  result
end