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 }.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
19 20 21 |
# File 'lib/vibe_sort/sorter.rb', line 19 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/vibe_sort/sorter.rb', line 14 def config @config end |
Instance Method Details
#perform(array) ⇒ Hash
Perform the sorting operation via the configured provider's API
28 29 30 |
# File 'lib/vibe_sort/sorter.rb', line 28 def perform(array) PROVIDER_CLASSES.fetch(config.provider).new(config).perform(array) end |