Class: RBS::Inline::AST::Annotations::Generic
- Includes:
- Utils
- Defined in:
- lib/rbs/inline/ast/annotations.rb
Overview
‘# @rbs generic [type param]`
“‘rb # @rbs generic X # @rbs generic in Y # @rbs generic unchecked out Z < String – Comment here “`
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
: String?.
-
#type_param ⇒ Object
readonly
TypeParam object or ‘nil` if 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.
571 572 573 574 575 576 577 578 579 580 581 582 |
# File 'lib/rbs/inline/ast/annotations.rb', line 571 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 ⇒ Object (readonly)
: String?
566 567 568 |
# File 'lib/rbs/inline/ast/annotations.rb', line 566 def comment @comment end |
#type_param ⇒ Object (readonly)
TypeParam object or ‘nil` if syntax error
564 565 566 |
# File 'lib/rbs/inline/ast/annotations.rb', line 564 def type_param @type_param end |