Class: RBS::BuiltinNames::Name
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rbs/builtin_names.rb |
Class Method Summary
Instance Attribute Summary
- #name readonly
Instance Method Summary
Constructor Details
.new(name:) ⇒ Name
# File 'lib/rbs/builtin_names.rb', line 8
def initialize(name:) @name = name end
Class Method Details
.define(name, namespace: Namespace.root)
[ GitHub ]Instance Attribute Details
#name (readonly)
[ GitHub ]# File 'lib/rbs/builtin_names.rb', line 6
attr_reader :name
Instance Method Details
#instance_type(*args)
[ GitHub ]# File 'lib/rbs/builtin_names.rb', line 16
def instance_type(*args) Types::ClassInstance.new(name: name, args: args, location: nil) end
#instance_type?(type) ⇒ Boolean
# File 'lib/rbs/builtin_names.rb', line 20
def instance_type?(type) type.is_a?(Types::ClassInstance) && type.name == name end
#singleton_type
[ GitHub ]# File 'lib/rbs/builtin_names.rb', line 24
def singleton_type @singleton_type ||= Types::ClassSingleton.new(name: name, location: nil) end
#singleton_type?(type) ⇒ Boolean
# File 'lib/rbs/builtin_names.rb', line 28
def singleton_type?(type) type.is_a?(Types::ClassSingleton) && type.name == name end
#to_s
[ GitHub ]# File 'lib/rbs/builtin_names.rb', line 12
def to_s name.to_s end