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.
293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/rbs/inline/ast/annotations.rb', line 293 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
288 289 290 |
# File 'lib/rbs/inline/ast/annotations.rb', line 288 def class_instance @class_instance end |
#comment ⇒ Object (readonly)
: String?
290 291 292 |
# File 'lib/rbs/inline/ast/annotations.rb', line 290 def comment @comment end |
#name ⇒ Object (readonly)
: Symbol
284 285 286 |
# File 'lib/rbs/inline/ast/annotations.rb', line 284 def name @name end |
#type ⇒ Object (readonly)
: Types::t?
286 287 288 |
# File 'lib/rbs/inline/ast/annotations.rb', line 286 def type @type end |