Class: Novel::Base
- Inherits:
-
Object
- Object
- Novel::Base
- Defined in:
- lib/novel/base.rb
Constant Summary collapse
- REPOSITORIES =
{ memory: SagaRepository.new(adapter: RepositoryAdapters::Memory.new) }
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #build(name:) ⇒ Object
-
#initialize(logger:, repository:, timeout:, **args) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(logger:, repository:, timeout:, **args) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 |
# File 'lib/novel/base.rb', line 11 def initialize(logger:, repository:, timeout:, **args) @logger = logger @repository = repository.is_a?(Symbol) ? REPOSITORIES[repository] : repository raise InvalidRepositoryError.new("Repository '#{repository}' does not exist in Novel. Please, use custom object insted") unless @repository @timeout = timeout end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/novel/base.rb', line 3 def logger @logger end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
3 4 5 |
# File 'lib/novel/base.rb', line 3 def repository @repository end |
Instance Method Details
#build(name:) ⇒ Object
18 19 20 |
# File 'lib/novel/base.rb', line 18 def build(name:) WorkflowBuilder.new(name: name, repository: repository) end |