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.
6 7 8 |
# File 'lib/rbs/builtin_names.rb', line 6 def initialize(name:) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/rbs/builtin_names.rb', line 4 def name @name end |
Class Method Details
Instance Method Details
#instance_type(*args) ⇒ Object
14 15 16 |
# File 'lib/rbs/builtin_names.rb', line 14 def instance_type(*args) Types::ClassInstance.new(name: name, args: args, location: nil) end |
#instance_type?(type) ⇒ Boolean
18 19 20 |
# File 'lib/rbs/builtin_names.rb', line 18 def instance_type?(type) type.is_a?(Types::ClassInstance) && type.name == name end |
#singleton_type ⇒ Object
22 23 24 |
# File 'lib/rbs/builtin_names.rb', line 22 def singleton_type @singleton_type ||= Types::ClassSingleton.new(name: name, location: nil) end |
#singleton_type?(type) ⇒ Boolean
26 27 28 |
# File 'lib/rbs/builtin_names.rb', line 26 def singleton_type?(type) type.is_a?(Types::ClassSingleton) && type.name == name end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/rbs/builtin_names.rb', line 10 def to_s name.to_s end |