Class: RBI::Rewriters::Annotate
- Defined in:
- lib/rbi/rewriters/annotate.rb
Instance Method Summary collapse
-
#initialize(annotation, annotate_scopes: false, annotate_properties: false) ⇒ Annotate
constructor
: (String annotation, ?annotate_scopes: bool, ?annotate_properties: bool) -> void.
-
#visit(node) ⇒ Object
: (Node? node) -> void.
Methods inherited from Visitor
Constructor Details
#initialize(annotation, annotate_scopes: false, annotate_properties: false) ⇒ Annotate
: (String annotation, ?annotate_scopes: bool, ?annotate_properties: bool) -> void
8 9 10 11 12 13 |
# File 'lib/rbi/rewriters/annotate.rb', line 8 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
: (Node? node) -> void
17 18 19 20 21 22 23 24 25 |
# File 'lib/rbi/rewriters/annotate.rb', line 17 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 |