Class: RBSProtobuf::Name::Class
- Inherits:
-
Object
- Object
- RBSProtobuf::Name::Class
- Defined in:
- lib/rbs_protobuf/name.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Class
constructor
A new instance of Class.
- #instance_type(*args) ⇒ Object (also: #[])
- #instance_type?(t) ⇒ Boolean
- #singleton_type ⇒ Object
- #singleton_type?(t) ⇒ Boolean
- #super_class(*args) ⇒ Object
Constructor Details
#initialize(name) ⇒ Class
Returns a new instance of Class.
6 7 8 9 |
# File 'lib/rbs_protobuf/name.rb', line 6 def initialize(name) raise unless name.class? @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/rbs_protobuf/name.rb', line 4 def name @name end |
Instance Method Details
#instance_type(*args) ⇒ Object Also known as: []
11 12 13 |
# File 'lib/rbs_protobuf/name.rb', line 11 def instance_type(*args) RBS::Types::ClassInstance.new(name: name, args: args, location: nil) end |
#instance_type?(t) ⇒ Boolean
21 22 23 |
# File 'lib/rbs_protobuf/name.rb', line 21 def instance_type?(t) t.is_a?(RBS::Types::ClassInstance) && t.name == name end |
#singleton_type ⇒ Object
17 18 19 |
# File 'lib/rbs_protobuf/name.rb', line 17 def singleton_type RBS::Types::ClassSingleton.new(name: name, location: nil) end |
#singleton_type?(t) ⇒ Boolean
25 26 27 |
# File 'lib/rbs_protobuf/name.rb', line 25 def singleton_type?(t) t.is_a?(RBS::Types::ClassSingleton) && t.name == name end |
#super_class(*args) ⇒ Object
29 30 31 |
# File 'lib/rbs_protobuf/name.rb', line 29 def super_class(*args) RBS::AST::Declarations::Class::Super.new(name: name, args: args, location: nil) end |