class Erlang::OtpErlangBinary
Attributes
bits[R]
value[R]
Public Class Methods
new(value, bits = 8)
click to toggle source
# File lib/erlang.rb, line 80 def initialize(value, bits = 8) @value = value @bits = bits # bits in last byte end
Public Instance Methods
==(other)
click to toggle source
# File lib/erlang.rb, line 109 def ==(other) return binary == other.binary end
Also aliased as: eql?
binary()
click to toggle source
# File lib/erlang.rb, line 86 def binary if @value.kind_of?(String) length = @value.bytesize if length > 4294967295 raise OutputException, 'uint32 overflow', caller elsif @bits != 8 length_packed = [length].pack('N') return "#{TAG_BIT_BINARY_EXT.chr}#{length_packed}" \ "#{@bits.chr}#{@value}" else length_packed = [length].pack('N') return "#{TAG_BINARY_EXT.chr}#{length_packed}#{@value}" end else raise OutputException, 'unknown binary type', caller end end
hash()
click to toggle source
# File lib/erlang.rb, line 106 def hash return binary.hash end
to_s()
click to toggle source
# File lib/erlang.rb, line 103 def to_s return "#{self.class.name}('#{@value.to_s}',bits=#{@bits.to_s})" end