Sha256: 22d07ad20584db43bfd71a37b79b39a335479f2b37ffceb683ec44d5222f0c91
Contents?: true
Size: 480 Bytes
Versions: 3
Compression:
Stored size: 480 Bytes
Contents
# frozen_string_literal: true module ActiveRecordDataLoader module ActiveRecord class IntegerValueGenerator class << self def generator_for(model_class:, ar_column:, connection_factory: nil) range_limit = [((256**number_of_bytes(ar_column)) / 2) - 1, 1_000_000_000].min -> { rand(0..range_limit) } end private def number_of_bytes(ar_column) ar_column.limit || 8 end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems