Class: Laser::Analysis::RuntimeAnnotation
- Inherits:
-
BasicAnnotation
- Object
- BasicAnnotation
- Laser::Analysis::RuntimeAnnotation
- Defined in:
- lib/laser/analysis/annotations/runtime_annotation.rb
Overview
This is a simple inherited attribute that specifies whether a given node will be executed when at load-time or at run-time. In short, method bodies and not-run blocks at the top-level are not run, and everything else is.
The possible values of #runtime are :load, :run, or :unknown.
Instance Attribute Summary
Attributes included from Visitor
Instance Method Summary (collapse)
- - (Object) annotate!(root)
- - (Object) default_visit(node)
- - (Object) visit_with_runtime(*nodes, new_runtime)
Methods inherited from BasicAnnotation
add_computed_property, add_global_annotator, add_property, inherited
Methods included from ModuleExtensions
#attr_accessor_with_default, #cattr_accessor, #cattr_accessor_with_default, #cattr_get_and_setter, #cattr_reader, #cattr_writer, #opposite_method
Methods included from Visitor
#annotate_with_text, included, #lines, #try_filters, #visit, #visit_children
Instance Method Details
- (Object) annotate!(root)
11 12 13 14 |
# File 'lib/laser/analysis/annotations/runtime_annotation.rb', line 11 def annotate!(root) @current_runtime = :load super end |
- (Object) default_visit(node)
16 17 18 19 |
# File 'lib/laser/analysis/annotations/runtime_annotation.rb', line 16 def default_visit(node) node.runtime = @current_runtime visit_children(node) end |
- (Object) visit_with_runtime(*nodes, new_runtime)
21 22 23 24 25 26 |
# File 'lib/laser/analysis/annotations/runtime_annotation.rb', line 21 def visit_with_runtime(*nodes, new_runtime) old_runtime, @current_runtime = @current_runtime, new_runtime nodes.each { |node| visit node } ensure @current_runtime = old_runtime end |