Sha256: 33e58f2543d69fe6a259b30572927dd02979bed142fc43c943bbbf83d017af5f

Contents?: true

Size: 721 Bytes

Versions: 7

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module AdequateSerialization
  module Steps
    def self.apply(object, *options)
      opts = Options.from(*options)

      response = Response.new(object, opts)
      decorator = Decorator.from(opts.attachments)

      decorator.decorate(AdequateSerialization.steps.apply(response))
    end

    class Response
      attr_reader :object, :opts

      def initialize(object, opts = {})
        @object = object
        @opts = opts
      end

      def mutate(new_object)
        self.class.new(new_object, opts)
      end
    end
  end

  class << self
    def prepend(step)
      @steps = step.new(steps)
    end

    def steps
      @steps ||= Steps::SerializeStep.new
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adequate_serialization-2.0.1 lib/adequate_serialization/steps.rb
adequate_serialization-2.0.0 lib/adequate_serialization/steps.rb
adequate_serialization-1.0.1 lib/adequate_serialization/steps.rb
adequate_serialization-1.0.0 lib/adequate_serialization/steps.rb
adequate_serialization-0.1.1 lib/adequate_serialization/steps.rb
adequate_serialization-0.1.0 lib/adequate_serialization/steps.rb
adequate_serialization-0.0.1 lib/adequate_serialization/steps.rb