class RBS::AST::Declarations::ModuleTypeParams

Constants

TypeParam

Attributes

params[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 44
def ==(other)
  other.is_a?(ModuleTypeParams) && other.params == params
end
Also aliased as: eql?
[](name) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 54
def [](name)
  params.find {|p| p.name == name }
end
add(param) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 39
def add(param)
  params << param
  self
end
each(&block) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 64
def each(&block)
  if block
    params.each(&block)
  else
    params.each
  end
end
empty?() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 86
def empty?
  params.empty?
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 50
def hash
  params.hash
end
rename_to(names) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 94
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, location: param.location))
    end
  end
end
size() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 90
def size
  params.size
end
skip_validation?(name) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 81
def skip_validation?(name)
  var = self[name] or raise
  var.skip_validation
end
to_json(state = _ = nil) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 58
def to_json(state = _ = nil)
  {
    params: params
  }.to_json(state)
end
variance(name) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/declarations.rb, line 76
def variance(name)
  var = self[name] or raise
  var.variance
end