Class: OllamaAgent::Topology::Extractors::RubySemanticExtractor
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- OllamaAgent::Topology::Extractors::RubySemanticExtractor
- Includes:
- IrNodesEmitter, MixinDispatch, Navigation
- Defined in:
- lib/ollama_agent/topology/extractors/ruby_semantic_extractor.rb,
lib/ollama_agent/topology/extractors/ruby_semantic_extractor/navigation.rb,
lib/ollama_agent/topology/extractors/ruby_semantic_extractor/concern_body.rb,
lib/ollama_agent/topology/extractors/ruby_semantic_extractor/mixin_dispatch.rb,
lib/ollama_agent/topology/extractors/ruby_semantic_extractor/parameter_list.rb,
lib/ollama_agent/topology/extractors/ruby_semantic_extractor/ir_nodes_emitter.rb,
lib/ollama_agent/topology/extractors/ruby_semantic_extractor/semantic_context.rb
Overview
Reopened in this file — see ruby_semantic_extractor.rb for the superclass.
Defined Under Namespace
Modules: ConcernBody, IrNodesEmitter, MixinDispatch, Navigation, ParameterList, SemanticContext Classes: ParseError
Constant Summary collapse
- EXTRACTOR_VERSION =
"1.0.0"
Instance Attribute Summary collapse
-
#on_parse_error ⇒ Object
Returns the value of attribute on_parse_error.
Instance Method Summary collapse
- #extract(file_path:) ⇒ Object
-
#initialize ⇒ RubySemanticExtractor
constructor
A new instance of RubySemanticExtractor.
Methods included from IrNodesEmitter
#emit_class, #emit_concern, #emit_module, #emit_worker_if_needed
Methods included from Navigation
#visit_call_node, #visit_class_node, #visit_def_node, #visit_module_node
Constructor Details
#initialize ⇒ RubySemanticExtractor
Returns a new instance of RubySemanticExtractor.
25 26 27 28 29 30 31 32 33 |
# File 'lib/ollama_agent/topology/extractors/ruby_semantic_extractor.rb', line 25 def initialize super @on_parse_error = nil @file_path = nil @nodes = [] @pending = [] @namespace_stack = [] @context_stack = [] end |
Instance Attribute Details
#on_parse_error ⇒ Object
Returns the value of attribute on_parse_error.
23 24 25 |
# File 'lib/ollama_agent/topology/extractors/ruby_semantic_extractor.rb', line 23 def on_parse_error @on_parse_error end |
Instance Method Details
#extract(file_path:) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ollama_agent/topology/extractors/ruby_semantic_extractor.rb', line 35 def extract(file_path:) reset!(file_path) result = Prism.parse(File.read(file_path), filepath: file_path) if result.failure? @on_parse_error&.call(ParseError.new(file_path, result.errors.map(&:message))) return [] end result.value.accept(self) @nodes.concat(@pending) @nodes end |