Class: RBI::TypedParam

Inherits:
T::Struct
  • Object
show all
Defined in:
lib/tapioca/rbi_ext/model.rb

Instance Method Summary collapse

Instance Method Details

#to_sig_param ⇒ Object

: -> RBI::SigParam



121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/tapioca/rbi_ext/model.rb', line 121

def to_sig_param
  name = case param
  when RestParam
    param.anonymous? ? "*".inspect : param.name.to_s
  when KwRestParam
    param.anonymous? ? "**".inspect : param.name.to_s
  when BlockParam
    param.anonymous? ? "&".inspect : param.name.to_s
  else
    param.name.to_s
  end
  RBI::SigParam.new(name, type)
end