Method: PDF::Core::ObjectStore#push

Defined in:
lib/pdf/core/object_store.rb

#push(reference) ⇒ reference #push(id, data) ⇒ Reference Also known as: <<

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.

Adds the given reference to the store and returns the reference object. If the object provided is not a PDF::Core::Reference, one is created from the arguments provided.

Overloads:

  • #push(reference) ⇒ reference

    Parameters:

    Returns:

    • (reference)
  • #push(id, data) ⇒ Reference

    Returns - the added reference.

    Parameters:

    • id (Integer)

      reference identifier

    • data (Hash, Array, Numeric, String, Symbol, Date, Time, nil)

      object data

    Returns:



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/pdf/core/object_store.rb', line 82

def push(*args)
  reference =
    if args.first.is_a?(PDF::Core::Reference)
      args.first
    else
      PDF::Core::Reference.new(*args)
    end

  @objects[reference.identifier] = reference
  @identifiers << reference.identifier
  reference
end