Sha256: ec4b9565addbef5b4de3f7b4f2187dad781d7748810e5b09c534735ccf396941

Contents?: true

Size: 842 Bytes

Versions: 27

Compression:

Stored size: 842 Bytes

Contents

module Foobara
  module CommandConnectors
    module Transformers
      class LoadAggregatesPreCommitTransformer < Value::Transformer
        def applicable?(request)
          request.command.outcome.success?
        end

        def transform(request)
          load_aggregates(request.command.outcome.result)

          request
        end

        def load_aggregates(object)
          case object
          when Entity
            object.class.load_aggregate(object)
          when Array
            object.each do |element|
              load_aggregates(element)
            end
          when Hash
            object.each_key do |key|
              load_aggregates(key)
            end

            object.each_value do |value|
              load_aggregates(value)
            end
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb
foobara-0.0.6 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb
foobara-0.0.5 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb
foobara-0.0.4 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb
foobara-0.0.3 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb
foobara-0.0.2 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb
foobara-0.0.1 projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb