Class: Serial::ArrayBuilder Private

Inherits:
Builder
  • Object
show all
Defined in:
lib/serial/array_builder.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Builder

#data

Instance Method Summary collapse

Methods inherited from Builder

build, #build, #exec

Constructor Details

#initialize(context) {|_self| ... } ⇒ ArrayBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ArrayBuilder.

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
# File 'lib/serial/array_builder.rb', line 4

def initialize(context, &block)
  @context = context
  @data = []
  yield self
end

Instance Method Details

#collection(key, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/serial/array_builder.rb', line 14

def collection(key, &block)
  @data << build(ArrayBuilder, &block)
end

#element(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'lib/serial/array_builder.rb', line 10

def element(&block)
  @data << build(HashBuilder, &block)
end