Class: RBS::BuiltinNames::Name
- Inherits:
-
Object
- Object
- RBS::BuiltinNames::Name
- Defined in:
- lib/rbs/builtin_names.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:) ⇒ Name
constructor
A new instance of Name.
- #instance_type(*args) ⇒ Object
- #instance_type?(type) ⇒ Boolean
- #singleton_type ⇒ Object
- #singleton_type?(type) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name:) ⇒ Name
Returns a new instance of Name.
8 9 10 |
# File 'lib/rbs/builtin_names.rb', line 8 def initialize(name:) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/rbs/builtin_names.rb', line 6 def name @name end |
Class Method Details
Instance Method Details
#instance_type(*args) ⇒ Object
16 17 18 |
# 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
20 21 22 |
# File 'lib/rbs/builtin_names.rb', line 20 def instance_type?(type) type.is_a?(Types::ClassInstance) && type.name == name end |
#singleton_type ⇒ Object
24 25 26 |
# 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
28 29 30 |
# File 'lib/rbs/builtin_names.rb', line 28 def singleton_type?(type) type.is_a?(Types::ClassSingleton) && type.name == name end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/rbs/builtin_names.rb', line 12 def to_s name.to_s end |