Module: Alba::Serializer::ClassMethods

Included in:
Alba::Serializer
Defined in:
lib/alba/serializer.rb

Overview

Class methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_metadataObject (readonly)

Returns the value of attribute _metadata.



53
54
55
# File 'lib/alba/serializer.rb', line 53

def 
  @_metadata
end

#_optsObject (readonly)

Returns the value of attribute _opts.



53
54
55
# File 'lib/alba/serializer.rb', line 53

def _opts
  @_opts
end

Instance Method Details

#metadata(name, &block) ⇒ Object

Set metadata

Parameters:

  • name (String, Symbol)

    key for the metadata

  • block (Block)

    the content of the metadata



72
73
74
# File 'lib/alba/serializer.rb', line 72

def (name, &block)
  @_metadata[name.to_sym] = block
end

#set(key: false) ⇒ Object

Set options, currently key only

Parameters:

  • key (Boolean, Symbol) (defaults to: false)


64
65
66
# File 'lib/alba/serializer.rb', line 64

def set(key: false)
  @_opts[:key] = key
end