Sha256: 6599878903bde2bbade061646274459d422d93fe40c5e056a991bfbafec6738a

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

require_relative "operations/completion"

module Roseflow
  module OpenRouter
    class OperationHandler
      OPERATION_CLASSES = {
        completion: Operations::Completion,
      }

      def initialize(operation, options = {})
        @operation = operation
        @options = options
      end

      def call
        operation_class.new(@options)
      end

      private

      def operation_class
        OPERATION_CLASSES.fetch(@operation) do
          raise ArgumentError, "Invalid operation: #{@operation}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roseflow-openrouter-0.2.0 lib/roseflow/open_router/operation_handler.rb