Class: RBS::Inline::AST::Annotations::Generic
- Includes:
- Utils
- Defined in:
- lib/rbs/inline/ast/annotations.rb,
sig/generated/rbs/inline/ast/annotations.rbs
Overview
# @rbs generic [type param]
# @rbs generic X
# @rbs generic in Y
# @rbs generic unchecked out Z < String -- Comment here
Instance Attribute Summary collapse
-
#comment ⇒ String?
readonly
: String?.
-
#type_param ⇒ RBS::AST::TypeParam?
readonly
TypeParam object or
nilif syntax error.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(tree, source) ⇒ Generic
constructor
A new instance of Generic.
Methods included from Utils
#translate_super_class, #translate_type_name, #translate_type_param
Constructor Details
#initialize(tree, source) ⇒ Generic
Returns a new instance of Generic.
572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/rbs/inline/ast/annotations.rb', line 572 def initialize(tree, source) @tree = tree @source = source generic_tree = tree.nth_tree!(1) @type_param = translate_type_param(generic_tree.nth_tree!(1)) if comment = generic_tree.nth_tree?(2) @comment = comment.to_s end end |
Instance Attribute Details
#comment ⇒ String? (readonly)
: String?
567 568 569 |
# File 'lib/rbs/inline/ast/annotations.rb', line 567 def comment @comment end |
#type_param ⇒ RBS::AST::TypeParam? (readonly)
TypeParam object or nil if syntax error
565 566 567 |
# File 'lib/rbs/inline/ast/annotations.rb', line 565 def type_param @type_param end |