Class: RBS::Types::ClassInstance
- Inherits:
-
Object
- Object
- RBS::Types::ClassInstance
show all
- Includes:
- Application
- Defined in:
- lib/rbs/types.rb
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:) ⇒ ClassInstance
Returns a new instance of ClassInstance.
357
358
359
360
361
|
# File 'lib/rbs/types.rb', line 357
def initialize(name:, args:, location:)
@name = name
@args = args
@location = location
end
|
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
353
354
355
|
# File 'lib/rbs/types.rb', line 353
def location
@location
end
|
Instance Method Details
#map_type(&block) ⇒ Object
381
382
383
384
385
386
387
388
389
390
391
|
# File 'lib/rbs/types.rb', line 381
def map_type(&block)
if block
ClassInstance.new(
name: name,
args: args.map {|type| yield type },
location: location
)
else
enum_for :map_type
end
end
|
#map_type_name(&block) ⇒ Object
373
374
375
376
377
378
379
|
# File 'lib/rbs/types.rb', line 373
def map_type_name(&block)
ClassInstance.new(
name: yield(name, location, self),
args: args.map {|type| type.map_type_name(&block) },
location: location
)
end
|
#sub(s) ⇒ Object
367
368
369
370
371
|
# File 'lib/rbs/types.rb', line 367
def sub(s)
self.class.new(name: name,
args: args.map {|ty| ty.sub(s) },
location: location)
end
|
#to_json(state = _ = nil) ⇒ Object
363
364
365
|
# File 'lib/rbs/types.rb', line 363
def to_json(state = _ = nil)
{ class: :class_instance, name: name, args: args, location: location }.to_json(state)
end
|