Sha256: aac2503e12aa61452dc4dbb80a902a93233c2b8a7c05d8d38b462b50b6bcf805

Contents?: true

Size: 669 Bytes

Versions: 7

Compression:

Stored size: 669 Bytes

Contents

module Asciidoctor
module PdfCore
module PdfObject
  # Convert the string to a PDF literal string if it can be encoded as ASCII-8BIT.
  # Otherwise, return the specified string.
  #--
  # QUESTION mixin to String and NilClass as to_pdf_value?
  def str2pdfval string
    if string && string.ascii_only?
      ::PDF::Core::LiteralString.new(string.encode ::Encoding::ASCII_8BIT)
    else
      string
    end
  end

  # Convert the string to a PDF object, first attempting to
  # convert it to a PDF literal string.
  #--
  # QUESTION mixin to String and NilClass as to_pdf_object?
  def str2pdfobj string
    ::PDF::Core::PdfObject(str2pdfval string)
  end
end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.alpha.13 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb
asciidoctor-pdf-1.5.0.alpha.12 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb
asciidoctor-pdf-1.5.0.alpha.11 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb
asciidoctor-pdf-1.5.0.alpha.10 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb
asciidoctor-pdf-1.5.0.alpha.9 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb
asciidoctor-pdf-1.5.0.alpha.8 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb
asciidoctor-pdf-1.5.0.alpha.7 lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb