class Fauna::Bytes

A Bytes wrapper.

Reference: FaunaDB Special Types

Attributes

bytes[RW]

The raw bytes.

Public Class Methods

from_base64(enc) click to toggle source

Create new Bytes object from Base64 encoded bytes.

    # File lib/fauna/objects.rb
129 def self.from_base64(enc)
130   new(Base64.urlsafe_decode64(enc))
131 end
new(bytes) click to toggle source

Creates a new Bytes wrapper with the given parameters.

bytes

The bytes to be wrapped by the Bytes object.

Reference: FaunaDB Special Types

    # File lib/fauna/objects.rb
111 def initialize(bytes)
112   self.bytes = bytes
113 end

Public Instance Methods

==(other) click to toggle source

Returns true if other is a Bytes and contains the same bytes.

    # File lib/fauna/objects.rb
121 def ==(other)
122   return false unless other.is_a? Bytes
123   bytes == other.bytes
124 end
Also aliased as: eql?
eql?(other)
Alias for: ==
to_hash() click to toggle source

Converts the Bytes to Hash form.

    # File lib/fauna/objects.rb
116 def to_hash
117   { :@bytes => Base64.urlsafe_encode64(bytes) }
118 end