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

Returns a new instance of ParamDef.



15
16
17
18
# File 'lib/solargraph/type_checker/param_def.rb', line 15

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

Instance Attribute Details

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#typeSymbol (readonly)

Returns:

  • (Symbol)


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.

Parameters:

Returns:



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

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