Module: RBS::Inline::AST::Declarations::DataStructUtil
- Included in:
- DataAssignDecl, StructAssignDecl
- Defined in:
- lib/rbs/inline/ast/declarations.rb,
sig/generated/rbs/inline/ast/declarations.rbs
Defined Under Namespace
Modules: _WithTypeDecls
Instance Method Summary collapse
Instance Method Details
#class_annotations ⇒ Array[RBS::AST::Annotation]
: Array
401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/rbs/inline/ast/declarations.rb', line 401 def class_annotations #: Array[RBS::AST::Annotation] annotations = [] #: Array[RBS::AST::Annotation] comments&.each_annotation do |annotation| if annotation.is_a?(Annotations::RBSAnnotation) annotations.concat annotation.annotations end end annotations end |
#each_attribute ⇒ void #each_attribute ⇒ Enumerator[[ Symbol, Annotations::TypeAssertion? ], void]
386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/rbs/inline/ast/declarations.rb', line 386 def each_attribute(&block) if block each_attribute_argument do |arg| if arg.is_a?(Prism::SymbolNode) if name = arg.value type = type_decls.fetch(arg.location.start_line, nil) yield [name.to_sym, type] end end end else enum_for :each_attribute end end |