==(other)
click to toggle source
def ==(other)
other.is_a?(ModuleTypeParams) && other.params == params
end
[](name)
click to toggle source
def [](name)
params.find {|p| p.name == name }
end
add(param)
click to toggle source
def add(param)
params << param
self
end
each(&block)
click to toggle source
def each(&block)
if block
params.each(&block)
else
params.each
end
end
empty?()
click to toggle source
def empty?
params.empty?
end
eql?(other)
click to toggle source
hash()
click to toggle source
rename_to(names)
click to toggle source
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
skip_validation?(name)
click to toggle source
def skip_validation?(name)
var = self[name] or raise
var.skip_validation
end
to_json(*a)
click to toggle source
def to_json(*a)
{
params: params
}.to_json(*a)
end
variance(name)
click to toggle source
def variance(name)
var = self[name] or raise
var.variance
end