class Sashite::CGN::UnsignedIntegerExcludingZero

Constants

PATTERN

Public Class Methods

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

  io.to_s
end
dumpable?(io) click to toggle source
# File lib/sashite/cgn/unsigned_integer_excluding_zero.rb, line 19
def self.dumpable? io
  loadable? io.to_s
end
load(io) click to toggle source
# File lib/sashite/cgn/unsigned_integer_excluding_zero.rb, line 13
def self.load io
  raise ArgumentError unless loadable? io

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