Class: VibeSort::Sorter
- Inherits:
-
Object
- Object
- VibeSort::Sorter
- Defined in:
- lib/vibe_sort/sorter.rb
Overview
Sorter dispatches the sorting operation to the configured provider adapter
Constant Summary collapse
- PROVIDER_CLASSES =
{ openai: Providers::OpenAI, anthropic: Providers::Anthropic, gemini: Providers::Gemini, groq: Providers::Groq, spacexai: Providers::SpaceXAI, openrouter: Providers::OpenRouter }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Sorter
constructor
Initialize a new Sorter.
-
#perform(array) ⇒ Hash
Perform the sorting operation via the configured provider's API.
Constructor Details
#initialize(config) ⇒ Sorter
Initialize a new Sorter
20 21 22 |
# File 'lib/vibe_sort/sorter.rb', line 20 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/vibe_sort/sorter.rb', line 15 def config @config end |
Instance Method Details
#perform(array) ⇒ Hash
Perform the sorting operation via the configured provider's API
29 30 31 |
# File 'lib/vibe_sort/sorter.rb', line 29 def perform(array) PROVIDER_CLASSES.fetch(config.provider).new(config).perform(array) end |