Class: JotPDF::Core::ObjectInterm

Inherits:
Object
  • Object
show all
Defined in:
lib/jot_pdf/core.rb

Instance Method Summary collapse

Constructor Details

#initialize(writer:, finalizer:) ⇒ ObjectInterm

Returns a new instance of ObjectInterm.



159
160
161
162
# File 'lib/jot_pdf/core.rb', line 159

def initialize(writer:, finalizer:)
  @writer = writer
  @finalizer = finalizer
end

Instance Method Details

#of_array(&block) ⇒ Object



206
207
208
209
210
211
# File 'lib/jot_pdf/core.rb', line 206

def of_array(&block)
  @writer << " ["
  ObjectWriteContext.new(@writer).dsl(&block)
  @writer << " ]"
  @finalizer.call
end

#of_bool(value) ⇒ Object



169
170
171
172
# File 'lib/jot_pdf/core.rb', line 169

def of_bool(value)
  @writer << " #{value}"
  @finalizer.call
end

#of_dict(&block) ⇒ Object



199
200
201
202
203
204
# File 'lib/jot_pdf/core.rb', line 199

def of_dict(&block)
  @writer << " <<\n"
  DictionaryWriteContext.new(@writer).dsl(&block)
  @writer << ">>"
  @finalizer.call
end

#of_hexstr(value) ⇒ Object



189
190
191
192
# File 'lib/jot_pdf/core.rb', line 189

def of_hexstr(value)
  @writer << " <" << value.to_s << ">"
  @finalizer.call
end

#of_name(name) ⇒ Object



174
175
176
177
# File 'lib/jot_pdf/core.rb', line 174

def of_name(name)
  @writer << " /#{name}"
  @finalizer.call
end

#of_nullObject



164
165
166
167
# File 'lib/jot_pdf/core.rb', line 164

def of_null
  @writer << " null"
  @finalizer.call
end

#of_num(i) ⇒ Object



179
180
181
182
# File 'lib/jot_pdf/core.rb', line 179

def of_num(i)
  @writer << " #{i}"
  @finalizer.call
end

#of_ref(object_ref) ⇒ Object



194
195
196
197
# File 'lib/jot_pdf/core.rb', line 194

def of_ref(object_ref)
  @writer << " #{object_ref.number} #{object_ref.generation} R"
  @finalizer.call
end

#of_str(value) ⇒ Object



184
185
186
187
# File 'lib/jot_pdf/core.rb', line 184

def of_str(value)
  @writer << " (" << value.to_s << ")"
  @finalizer.call
end