Class: Trailblazer::Context::Container

Inherits:
Object
  • Object
show all
Extended by:
Delegations
Includes:
CommonMethods
Defined in:
lib/trailblazer/context/container.rb,
lib/trailblazer/context/container/with_aliases.rb

Direct Known Subclasses

WithAliases

Defined Under Namespace

Modules: CommonMethods, Delegations Classes: UseWithAliases, WithAliases

Instance Method Summary collapse

Methods included from CommonMethods

#[], #[]=, #delete, #each, #fetch, #key?, #keys, #merge, #to_hash, #value?, #values

Constructor Details

#initialize(wrapped_options, mutable_options, replica_class:, aliases: nil) ⇒ Container

Returns a new instance of Container.

Raises:


14
15
16
17
18
19
20
21
22
# File 'lib/trailblazer/context/container.rb', line 14

def initialize(wrapped_options, mutable_options, replica_class:, aliases: nil, **)
  raise UseWithAliases if aliases

  @wrapped_options  = wrapped_options
  @mutable_options  = mutable_options
  @replica_class    = replica_class

  @replica = initialize_replica_store
end

Instance Method Details

#decomposeObject

Return the Context's two components. Used when computing the new output for the next activity.


26
27
28
# File 'lib/trailblazer/context/container.rb', line 26

def decompose
  [@wrapped_options, @mutable_options]
end

#inspectObject Also known as: to_s


30
31
32
# File 'lib/trailblazer/context/container.rb', line 30

def inspect
  %{#<Trailblazer::Context::Container wrapped_options=#{@wrapped_options} mutable_options=#{@mutable_options}>}
end