Sha256: e45b2686bbb73f73e82b436ba3ab016f27bfe826ac2ee6def0bc7e69324d7e4b
Contents?: true
Size: 453 Bytes
Versions: 4
Compression:
Stored size: 453 Bytes
Contents
# frozen_string_literal: true module ActiveRecordDataLoader module ActiveRecord class IntegerValueGenerator class << self def generator_for(model_class:, ar_column:) 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
4 entries across 4 versions & 1 rubygems