Class: RBS::Types::Alias
Instance Attribute Summary collapse
Attributes included from Application
#args, #name
Instance Method Summary
collapse
#==, #each_type, #free_variables, #has_classish_type?, #has_self_type?, #hash, #to_s, #with_nonreturn_void?
Constructor Details
#initialize(name:, args:, location:) ⇒ Alias
Returns a new instance of Alias.
405
406
407
408
409
|
# File 'lib/rbs/types.rb', line 405
def initialize(name:, args:, location:)
@name = name
@args = args
@location = location
end
|
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
401
402
403
|
# File 'lib/rbs/types.rb', line 401
def location
@location
end
|
Instance Method Details
#map_type(&block) ⇒ Object
429
430
431
432
433
434
435
436
437
438
439
|
# File 'lib/rbs/types.rb', line 429
def map_type(&block)
if block
Alias.new(
name: name,
args: args.map {|type| yield type },
location: location
)
else
enum_for :map_type
end
end
|
#map_type_name(&block) ⇒ Object
421
422
423
424
425
426
427
|
# File 'lib/rbs/types.rb', line 421
def map_type_name(&block)
Alias.new(
name: yield(name, location, self),
args: args.map {|arg| arg.map_type_name(&block) },
location: location
)
end
|
#sub(s) ⇒ Object
415
416
417
418
419
|
# File 'lib/rbs/types.rb', line 415
def sub(s)
return self if s.empty?
Alias.new(name: name, args: args.map {|ty| ty.sub(s) }, location: location)
end
|
#to_json(state = _ = nil) ⇒ Object
411
412
413
|
# File 'lib/rbs/types.rb', line 411
def to_json(state = _ = nil)
{ class: :alias, name: name, args: args, location: location }.to_json(state)
end
|