Class: Wallets::Allocation

Inherits:
ApplicationRecord show all
Defined in:
lib/wallets/models/allocation.rb

Overview

Allocations link a negative spend transaction to the positive transactions it consumed from. This is what makes FIFO spending and expiration-aware balances possible without mutating historical transactions.

This class supports embedding: subclasses can override config and table names without affecting the base Wallets::* behavior.

Class Method Summary collapse

Class Method Details

.resolved_configObject



18
19
20
21
# File 'lib/wallets/models/allocation.rb', line 18

def self.resolved_config
  value = config_provider
  value.respond_to?(:call) ? value.call : value
end

.table_nameObject



14
15
16
# File 'lib/wallets/models/allocation.rb', line 14

def self.table_name
  embedded_table_name || "#{resolved_config.table_prefix}allocations"
end