Class: Spoom::RBS::Comments
- Inherits:
-
Object
- Object
- Spoom::RBS::Comments
- Defined in:
- lib/spoom/rbs.rb
Instance Attribute Summary collapse
- #annotations ⇒ Object readonly
- #signatures ⇒ Object readonly
Instance Method Summary collapse
- #class_annotations ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Comments
constructor
A new instance of Comments.
- #method_annotations ⇒ Object
Constructor Details
#initialize ⇒ Comments
Returns a new instance of Comments.
14 15 16 17 |
# File 'lib/spoom/rbs.rb', line 14 def initialize @annotations = [] #: Array[Annotation] @signatures = [] #: Array[Signature] end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
8 9 10 |
# File 'lib/spoom/rbs.rb', line 8 def annotations @annotations end |
#signatures ⇒ Object (readonly)
11 12 13 |
# File 'lib/spoom/rbs.rb', line 11 def signatures @signatures end |
Instance Method Details
#class_annotations ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/spoom/rbs.rb', line 25 def class_annotations @annotations.select do |annotation| case annotation.string when "@abstract", "@interface", "@sealed", "@final" true when /^@requires_ancestor: / true else false end end end |
#empty? ⇒ Boolean
20 21 22 |
# File 'lib/spoom/rbs.rb', line 20 def empty? @annotations.empty? && @signatures.empty? end |
#method_annotations ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/spoom/rbs.rb', line 39 def method_annotations @annotations.select do |annotation| case annotation.string when "@abstract", "@final", "@override", "@override(allow_incompatible: true)", "@override(allow_incompatible: :visibility)", "@overridable", "@without_runtime" true else false end end end |