Class: RailsMcpCodeSearch::Runtime
- Inherits:
-
Object
- Object
- RailsMcpCodeSearch::Runtime
- Defined in:
- lib/rails_mcp_code_search/runtime.rb
Instance Attribute Summary collapse
-
#db_path ⇒ Object
readonly
Returns the value of attribute db_path.
-
#embedding_adapter ⇒ Object
readonly
Returns the value of attribute embedding_adapter.
-
#indexer ⇒ Object
readonly
Returns the value of attribute indexer.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
Class Method Summary collapse
Instance Method Summary collapse
- #boot ⇒ Object
-
#initialize(project_path: Dir.pwd, db_path: nil) ⇒ Runtime
constructor
A new instance of Runtime.
- #shutdown ⇒ Object
Constructor Details
#initialize(project_path: Dir.pwd, db_path: nil) ⇒ Runtime
Returns a new instance of Runtime.
11 12 13 14 15 16 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 11 def initialize(project_path: Dir.pwd, db_path: nil) @project_path = project_path @db_path = db_path @logger = Logger.new($stderr, level: log_level) @logger.formatter = proc { |severity, _time, _progname, msg| "[rails-mcp-code-search] #{severity}: #{msg}\n" } end |
Instance Attribute Details
#db_path ⇒ Object (readonly)
Returns the value of attribute db_path.
5 6 7 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 5 def db_path @db_path end |
#embedding_adapter ⇒ Object (readonly)
Returns the value of attribute embedding_adapter.
5 6 7 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 5 def end |
#indexer ⇒ Object (readonly)
Returns the value of attribute indexer.
5 6 7 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 5 def indexer @indexer end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 5 def logger @logger end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
5 6 7 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 5 def project_path @project_path end |
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
5 6 7 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 5 def worker @worker end |
Class Method Details
.boot(project_path: Dir.pwd, db_path: nil) ⇒ Object
7 8 9 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 7 def self.boot(project_path: Dir.pwd, db_path: nil) new(project_path:, db_path:).tap(&:boot) end |
Instance Method Details
#boot ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 18 def boot @db_path = Database.setup(project_path: @project_path, db_path: @db_path) = build_adapter check_dimension_mismatch @indexer = Indexer.new(embedding_adapter: , project_path: @project_path, logger: @logger) @worker = BackgroundWorker.new(indexer: @indexer, logger: @logger) @worker.start setup_shutdown_hooks @logger.info "Booted for #{@project_path}" end |
#shutdown ⇒ Object
29 30 31 32 |
# File 'lib/rails_mcp_code_search/runtime.rb', line 29 def shutdown @worker&.stop @logger.info "Shut down" end |