Sha256: 2c0aafd1fe28c52c0f9fda352502fd968f6d2bbece7df559a08efebfc0861dca
Contents?: true
Size: 431 Bytes
Versions: 3
Compression:
Stored size: 431 Bytes
Contents
module DeadSimpleDb class SdbInteger include NegativeNumber DEFAULT_OPTS = {:digits => 6} def initialize(value, opts={}) @opts = DEFAULT_OPTS.merge(opts) @value_before_cast = value end def casted @casted ||= @value_before_cast.to_i end def to_s @string ||= prepending_minus(casted.to_s) do |string| string.rjust(@opts[:digits], '0') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems