lib/lockbox.rb in lockbox-0.3.1 vs lib/lockbox.rb in lockbox-0.3.2

- old
+ new

@@ -1,6 +1,7 @@ -# dependencies +# stdlib +require "base64" require "openssl" require "securerandom" # modules require "lockbox/box" @@ -33,10 +34,12 @@ module Lockbox class Error < StandardError; end class DecryptionError < Error; end class PaddingError < Error; end + autoload :Audit, "lockbox/audit" + extend Padding class << self attr_accessor :default_options attr_writer :master_key @@ -45,11 +48,15 @@ def self.master_key @master_key ||= ENV["LOCKBOX_MASTER_KEY"] end - def self.migrate(model, restart: false) - Migrator.new(model).migrate(restart: restart) + def self.migrate(relation, batch_size: 1000, restart: false) + Migrator.new(relation, batch_size: batch_size).migrate(restart: restart) + end + + def self.rotate(relation, batch_size: 1000, attributes:) + Migrator.new(relation, batch_size: batch_size).rotate(attributes: attributes) end def self.generate_key SecureRandom.hex(32) end