module RLP::Extensions::Fixnum

Public Instance Methods

as_int() click to toggle source
# File lib/core_ext/fixnum.rb, line 6
def as_int
  return self
end
as_string() click to toggle source
# File lib/core_ext/fixnum.rb, line 10
def as_string
  return self.chr
end
bytes() click to toggle source

This makes sure for isntance 1024 becomes [0,0,0,0,0,0,4,0] and in turn [4,0]

# File lib/core_ext/fixnum.rb, line 19
def bytes
  [self].pack("q>").bytes.to_a.drop_while{|x| x == 0}
end
bytesize() click to toggle source
# File lib/core_ext/fixnum.rb, line 14
def bytesize
  self.bytes.length
end