Class: Roast::Workflow::StateRepositoryFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/roast/workflow/state_repository_factory.rb

Overview

Factory for creating the appropriate StateRepository implementation

Class Method Summary collapse

Class Method Details

.create(type = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/roast/workflow/state_repository_factory.rb', line 8

def create(type = nil)
  type ||= default_type

  case type.to_s
  when "sqlite"
    # Lazy load the SQLite repository only when needed
    Roast::Workflow::SqliteStateRepository.new
  when "file", "filesystem"
    Roast::Workflow::FileStateRepository.new
  else
    raise ArgumentError, "Unknown state repository type: #{type}. Valid types are: sqlite, file"
  end
end