module Sashite::CGN::Integer

Constants

PATTERN

Public Class Methods

dump(io) click to toggle source
# File lib/sashite/cgn/integer.rb, line 23
def self.dump io
  raise ArgumentError unless dumpable? io

  NegativeInteger.dumpable?(io) ? NegativeInteger.dump(io) : UnsignedInteger.dump(io)
end
dumpable?(io) click to toggle source
# File lib/sashite/cgn/integer.rb, line 19
def self.dumpable? io
  NegativeInteger.dumpable?(io) || UnsignedInteger.dumpable?(io)
end
load(io) click to toggle source
# File lib/sashite/cgn/integer.rb, line 13
def self.load io
  raise ArgumentError unless loadable? io

  NegativeInteger.loadable?(io) ? NegativeInteger.load(io) : UnsignedInteger.load(io)
end
loadable?(io) click to toggle source
# File lib/sashite/cgn/integer.rb, line 9
def self.loadable? io
  !!io.match("^#{PATTERN}$")
end