Class: RBS::Inline::AST::Members::RBSIvar
- Defined in:
- lib/rbs/inline/ast/members.rb
Instance Attribute Summary collapse
-
#annotation ⇒ Object
readonly
: Annotations::IvarType.
-
#comment ⇒ Object
readonly
: AnnotationParser::ParsingResult.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(comment, annotation) ⇒ RBSIvar
constructor
A new instance of RBSIvar.
-
#rbs ⇒ Object
: RBS::AST::Members::InstanceVariable | RBS::AST::Members::ClassInstanceVariable | nil.
Methods inherited from Base
Constructor Details
#initialize(comment, annotation) ⇒ RBSIvar
524 525 526 527 528 529 |
# File 'lib/rbs/inline/ast/members.rb', line 524 def initialize(comment, annotation) #: void @comment = comment @annotation = annotation super(comment.comments[0].location) end |
Instance Attribute Details
#annotation ⇒ Object (readonly)
: Annotations::IvarType
518 519 520 |
# File 'lib/rbs/inline/ast/members.rb', line 518 def annotation @annotation end |
#comment ⇒ Object (readonly)
: AnnotationParser::ParsingResult
520 521 522 |
# File 'lib/rbs/inline/ast/members.rb', line 520 def comment @comment end |
Instance Method Details
#rbs ⇒ Object
: RBS::AST::Members::InstanceVariable | RBS::AST::Members::ClassInstanceVariable | nil
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/rbs/inline/ast/members.rb', line 531 def rbs #: RBS::AST::Members::InstanceVariable | RBS::AST::Members::ClassInstanceVariable | nil if annotation.type if annotation.comment string = annotation.comment.delete_prefix("--").lstrip comment = RBS::AST::Comment.new(string: string, location: nil) end if annotation.class_instance RBS::AST::Members::ClassInstanceVariable.new( name: annotation.name, type: annotation.type, location: nil, comment: comment ) else RBS::AST::Members::InstanceVariable.new( name: annotation.name, type: annotation.type, location: nil, comment: comment ) end end end |