Class: TypedOperation::Configuration
- Inherits:
-
Object
- Object
- TypedOperation::Configuration
- Defined in:
- lib/typed_operation/configuration.rb
Overview
Global configuration for TypedOperation.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
: () -> void.
-
#result_adapter ⇒ Object
Get the current result adapter.
-
#result_adapter=(adapter) ⇒ Object
Set the result adapter.
Constructor Details
#initialize ⇒ Configuration
: () -> void
10 11 12 |
# File 'lib/typed_operation/configuration.rb', line 10 def initialize @result_adapter = nil end |
Instance Method Details
#result_adapter ⇒ Object
Get the current result adapter. Defaults to BuiltIn. : () -> (Result::Adapters::BuiltIn | Result::Adapters::DryMonads | untyped)
16 17 18 |
# File 'lib/typed_operation/configuration.rb', line 16 def result_adapter @result_adapter ||= Result::Adapters::BuiltIn.new end |
#result_adapter=(adapter) ⇒ Object
Set the result adapter. : (:built_in | :dry_monads | untyped) -> void
22 23 24 25 26 27 28 |
# File 'lib/typed_operation/configuration.rb', line 22 def result_adapter=(adapter) @result_adapter = case adapter when :built_in then Result::Adapters::BuiltIn.new when :dry_monads then Result::Adapters::DryMonads.new else adapter end end |