class Transit::ByteArray

Represents a transit byte array extension type. @see github.com/cognitect/transit-format

Public Class Methods

from_base64(data) click to toggle source
# File lib/transit/transit_types.rb, line 62
def self.from_base64(data)
  new(Base64.decode64(data))
end

Public Instance Methods

to_base64() click to toggle source
# File lib/transit/transit_types.rb, line 66
def to_base64
  Base64.encode64(@value)
end
to_s() click to toggle source

For human-readable display only. Use value() for programmatic consumption of the decoded value.

Forces the platform's default external encoding, which is potentially lossy, but also guarantees that something will be printed instead of raising an error when there is no encoding information provided.

# File lib/transit/transit_types.rb, line 77
def to_s
  @value.dup.force_encoding(Encoding.default_external)
end