Class: RBI::Rewriters::Annotate
- Extended by:
- T::Sig
- Defined in:
- lib/rbi/rewriters/annotate.rb
Instance Method Summary collapse
-
#initialize(annotation, annotate_scopes: false, annotate_properties: false) ⇒ Annotate
constructor
A new instance of Annotate.
- #visit(node) ⇒ Object
Methods inherited from Visitor
Constructor Details
#initialize(annotation, annotate_scopes: false, annotate_properties: false) ⇒ Annotate
Returns a new instance of Annotate.
10 11 12 13 14 15 |
# File 'lib/rbi/rewriters/annotate.rb', line 10 def initialize(annotation, annotate_scopes: false, annotate_properties: false) super() @annotation = annotation @annotate_scopes = annotate_scopes @annotate_properties = annotate_properties end |
Instance Method Details
#visit(node) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rbi/rewriters/annotate.rb', line 18 def visit(node) case node when Scope annotate_node(node) if @annotate_scopes || root?(node) when Const, Attr, Method, TStructField, TypeMember annotate_node(node) if @annotate_properties end visit_all(node.nodes) if node.is_a?(Tree) end |