Sha256: c63a7d5c9f3689e8a780f647c8f0e218e905f4854b3fd5ded65167f14fab445a

Contents?: true

Size: 676 Bytes

Versions: 10

Compression:

Stored size: 676 Bytes

Contents

module JSONAPIonify::Api
  module Resource::Definitions::ResponseHeaders
    using JSONAPIonify::DestructuredProc

    def self.extended(klass)
      klass.class_eval do
        extend JSONAPIonify::InheritedAttributes
        inherited_hash_attribute :response_header_definitions

        context(:response_headers, persisted: true) do |context|
          self.class.response_header_definitions.each_with_object({}) do |(name, block), headers|
            headers[name.to_s] = instance_exec(context, &block.destructure)
          end
        end
      end
    end

    def response_header(name, &block)
      self.response_header_definitions[name] = block
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jsonapionify-0.12.10 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.9 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.8 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.7 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.5 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.4 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.3 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.2 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.1 lib/jsonapionify/api/resource/definitions/response_headers.rb
jsonapionify-0.12.0 lib/jsonapionify/api/resource/definitions/response_headers.rb