Class: RailsAiBridge::Service
- Inherits:
-
Object
- Object
- RailsAiBridge::Service
- Defined in:
- lib/rails_ai_bridge/service.rb,
lib/rails_ai_bridge/service/result.rb
Overview
Base service class providing a standardized interface for all services.
Services follow the command pattern with a single public method (.call) that returns a Service::Result object. This provides consistent error handling and result structure across all services.
Direct Known Subclasses
RailsAiBridge::Services::AppIntrospectionService, RailsAiBridge::Services::ConfigurationService, RailsAiBridge::Services::ContextGenerationService, RailsAiBridge::Services::FileManagementService
Defined Under Namespace
Classes: Result
Class Method Summary collapse
-
.call ⇒ Service::Result
Class-level entry point that creates an instance and calls it.
Instance Method Summary collapse
-
#call ⇒ Service::Result
Execute the service and return a result.
-
#initialize(*args, **kwargs) ⇒ Service
constructor
Initialize the service with provided arguments.
Constructor Details
#initialize(*args, **kwargs) ⇒ Service
Initialize the service with provided arguments.
40 41 42 43 44 |
# File 'lib/rails_ai_bridge/service.rb', line 40 def initialize(*args, **kwargs) # Standard initialization @args = args @kwargs = kwargs end |
Class Method Details
.call ⇒ Service::Result
Class-level entry point that creates an instance and calls it.
31 32 33 |
# File 'lib/rails_ai_bridge/service.rb', line 31 def call(*, **) new(*, **).call end |
Instance Method Details
#call ⇒ Service::Result
Execute the service and return a result.
Subclasses must override this method to implement specific business logic.
52 53 54 |
# File 'lib/rails_ai_bridge/service.rb', line 52 def call raise NotImplementedError, "#{self.class} must implement #call" end |