lib/xdr/struct.rb
def to_xdr(format=:raw)
    raw = self.class.to_xdr(self)

    case format
    when :raw ;     raw
    when :hex ;     raw.unpack("H*").first
    when :base64 ;  Base64.strict_encode64(raw)
    else ; 
      raise ArgumentError, "Invalid format #{format.inspect}; must be :raw, :hex, or :base64"
    end
  end
# 
# Serializes struct to xdr, return a string of bytes
# 
# @param format=:raw [Symbol] The encoding used for the bytes produces, one of (:raw, :hex, :base64)
# 
# @return [String] The encoded bytes of this struct
Serializes struct to xdr, return a string of bytes
Serializes struct to xdr return a string of bytes
def to_xdr(format=:raw)
    raw = self.class.to_xdr(self)
    case format
    when :raw ;     raw
    when :hex ;     raw.unpack("H*").first
    when :base64 ;  Base64.strict_encode64(raw)
    else ; 
      raise ArgumentError, "Invalid format #{format.inspect}; must be :raw, :hex, or :base64"
    end
  end
def to_xdr ( format = :raw ) raw = self . class . to_xdr ( self ) case format when :raw ; raw when :hex ; raw . unpack ( "H*" ) . first when :base64 ; Base64 . strict_encode64 ( raw ) else ; raise ArgumentError , "Invalid format #{format.inspect}; must be :raw, :hex, or :base64" end end
Serializes struct to xdr, return a string of bytes
Serializes struct to xdr return a string of bytes
The encoded bytes of this struct
The encoded bytes of this struct
String
format
format=:raw
The encoding used for the bytes produces, one of (:raw, :hex, :base64)
The encoding used for the bytes produces one of ( : raw : hex : base64 )