Module: JSONAPI::Serializable::Resource::Meta::DSL

Defined in:
lib/jsonapi/serializable/resource/meta.rb

Overview

DSL methods for declaring resource meta.

Instance Method Summary collapse

Instance Method Details

#inherited(klass) ⇒ Object



34
35
36
37
38
# File 'lib/jsonapi/serializable/resource/meta.rb', line 34

def inherited(klass)
  super
  klass.meta_val   = meta_val
  klass.meta_block = meta_block
end

#meta(value) ⇒ Object #meta(&block) ⇒ Object

Overloads:

  • #meta(value) ⇒ Object

    Declare the meta information for this resource.

    Examples:

    meta key: value

    Parameters:

    • value (Hash)

      The meta information hash.

  • #meta(&block) ⇒ Object

    Declare the meta information for this resource.

    Examples:

    meta do
      { key: value }
    end

    Yield Returns:

    • (String)

      The meta information hash.



54
55
56
57
# File 'lib/jsonapi/serializable/resource/meta.rb', line 54

def meta(value = nil, &block)
  self.meta_val = value
  self.meta_block = block
end