Sha256: 33f559a09d8d450af398e140c04398ce4c58d75270ae2ccd24b41c51a954bf83

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

# frozen_string_literal: true

module ApiResponse
  class Presenter
    extend Dry::Initializer

    param :response
    option :config, default: -> { ApiResponse.config.dup }
    option :options, type: Types::Hash, default: -> { {} }

    def self.call(response, **options, &block)
      new(response, options: options).call(&block)
    end

    def call(&block)
      if block
        Processor.call(response, config: config, options: options, &block)
      else
        Processor.call(response, config: config, options: options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api-response-presenter-0.0.2 lib/api_response/presenter.rb
api-response-presenter-0.0.1 lib/api_response/presenter.rb