Module: JSONAPIonify::Api::Resource::Definitions::ResponseHeaders
- Defined in:
- lib/jsonapionify/api/resource/definitions/response_headers.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(klass) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jsonapionify/api/resource/definitions/response_headers.rb', line 4 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) end end end end |
Instance Method Details
#response_header(name, &block) ⇒ Object
17 18 19 |
# File 'lib/jsonapionify/api/resource/definitions/response_headers.rb', line 17 def response_header(name, &block) self.response_header_definitions[name] = block end |