Class: Serial::Builder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/serial/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.

Direct Known Subclasses

ArrayBuilder, HashBuilder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject (readonly)

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.



8
9
10
# File 'lib/serial/builder.rb', line 8

def data
  @data
end

Class Method Details

.build(context, &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.



4
5
6
# File 'lib/serial/builder.rb', line 4

def self.build(context, &block)
  new(context, &block).data
end

Instance Method Details

#build(builder_klass, *args, &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.



18
19
20
21
22
# File 'lib/serial/builder.rb', line 18

def build(builder_klass, *args, &block)
  builder_klass.build(@context) do |builder|
    builder.exec(*args, &block)
  end
end

#exec(*args, &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
13
14
15
16
# File 'lib/serial/builder.rb', line 10

def exec(*args, &block)
  if @context
    @context.instance_exec(self, *args, &block)
  else
    block.call(self, *args)
  end
end