Method: Serial::HashBuilder#collection

Defined in:
lib/serial/hash_builder.rb

#collection(key) {|builder| ... } ⇒ Object

Declare a collection attribute. This is a low-level method, see #map instead.

Examples:

h.collection(:people) do |l|
  l.element do |h|
    h.attribute(

Parameters:

  • key (#to_s)

Yields:

  • (builder)

Yield Parameters:

See Also:



67
68
69
70
# File 'lib/serial/hash_builder.rb', line 67

def collection(key, &block)
  check_duplicate_key!(key)
  collection!(key, &block)
end