Module: Roar::JSON::JSONAPI::Meta::ClassMethods

Defined in:
lib/roar/json/json_api/meta.rb

Overview

Class level interface

Instance Method Summary collapse

Instance Method Details

#meta(&block) ⇒ Object

Define meta information.

Examples:

meta do
  property :copyright
  collection :reviewers
end

Parameters:

  • block (#call)

See Also:



35
36
37
38
39
40
41
42
# File 'lib/roar/json/json_api/meta.rb', line 35

def meta(&block)
  representable_attrs[:meta_representer] ||= nested_builder.(
    _base:     default_nested_class,
    _features: [Roar::JSON, JSONAPI::Defaults],
    _block:    Proc.new
  )
  representable_attrs[:meta_representer].instance_exec(&block)
end