In Files

  • rbs-1.0.4/lib/rbs/ast/declarations.rb
  • rbs-1.0.4/lib/rbs/prototype/rbi.rb

Class/Module Index [+]

Quicksearch

RBS::AST::Declarations::ModuleTypeParams

Constants

TypeParam

Attributes

params[R]

Public Class Methods

empty() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 57
def self.empty
  new
end
            
new() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 20
def initialize()
  @params = []
end
            

Public Instance Methods

==(other) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 29
def ==(other)
  other.is_a?(ModuleTypeParams) && other.params == params
end
            
Also aliased as: eql?
[](name) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 39
def [](name)
  params.find {|p| p.name == name }
end
            
add(param) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 24
def add(param)
  params << param
  self
end
            
each(&block) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 49
def each(&block)
  if block
    params.each(&block)
  else
    params.each
  end
end
            
empty?() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 71
def empty?
  params.empty?
end
            
eql?(other) click to toggle source
Alias for: ==
hash() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 35
def hash
  params.hash
end
            
rename_to(names) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 79
def rename_to(names)
  ModuleTypeParams.new().tap do |params|
    names.each.with_index do |new_name, index|
      param = self.params[index]
      params.add(TypeParam.new(name: new_name, variance: param.variance, skip_validation: param.skip_validation))
    end
  end
end
            
size() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 75
def size
  params.size
end
            
skip_validation?(name) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 66
def skip_validation?(name)
  var = self[name] or raise
  var.skip_validation
end
            
to_json(*a) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 43
def to_json(*a)
  {
    params: params
  }.to_json(*a)
end
            
variance(name) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/ast/declarations.rb, line 61
def variance(name)
  var = self[name] or raise
  var.variance
end