Class: RBS::Inline::AST::Annotations::IvarType
- Defined in:
- lib/rbs/inline/ast/annotations.rb
Overview
‘@rbs @foo: T` or `@rbs self.@foo: T`
Instance Attribute Summary collapse
-
#class_instance ⇒ Object
readonly
: bool.
-
#comment ⇒ Object
readonly
: String?.
-
#name ⇒ Object
readonly
: Symbol.
-
#type ⇒ Object
readonly
: Types::t?.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(tree, source) ⇒ IvarType
constructor
A new instance of IvarType.
Constructor Details
#initialize(tree, source) ⇒ IvarType
Returns a new instance of IvarType.
294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/rbs/inline/ast/annotations.rb', line 294 def initialize(tree, source) @tree = tree @source = source ivar_tree = tree.nth_tree!(1) @class_instance = ivar_tree.nth_token?(0).is_a?(Array) @name = ivar_tree.nth_token!(2).last.to_sym @type = ivar_tree.nth_type?(4) if comment = ivar_tree.nth_tree(5) @comment = comment.to_s end end |
Instance Attribute Details
#class_instance ⇒ Object (readonly)
: bool
289 290 291 |
# File 'lib/rbs/inline/ast/annotations.rb', line 289 def class_instance @class_instance end |
#comment ⇒ Object (readonly)
: String?
291 292 293 |
# File 'lib/rbs/inline/ast/annotations.rb', line 291 def comment @comment end |
#name ⇒ Object (readonly)
: Symbol
285 286 287 |
# File 'lib/rbs/inline/ast/annotations.rb', line 285 def name @name end |
#type ⇒ Object (readonly)
: Types::t?
287 288 289 |
# File 'lib/rbs/inline/ast/annotations.rb', line 287 def type @type end |