Module: SeedBuilder

Defined in:
lib/seed_builder.rb,
lib/seed_builder/config.rb,
lib/seed_builder/loader.rb,
lib/seed_builder/railtie.rb

Defined Under Namespace

Classes: Config, Loader, Railtie

Constant Summary collapse

VERSION =
"1.3.0".freeze

Class Method Summary collapse

Class Method Details

.configObject



10
11
12
# File 'lib/seed_builder.rb', line 10

def config
  @@config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



14
15
16
# File 'lib/seed_builder.rb', line 14

def configure
  yield config
end

.loggerObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/seed_builder.rb', line 18

def logger
  # Use configured logger if set
  base_logger = if config.logger
    config.logger
  elsif defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
    Rails.logger
  else
    Logger.new($stdout)
  end

  # If the logger already supports tagging (e.g., Rails.logger is already TaggedLogging),
  # use it directly to avoid double-wrapping and ensure tags propagate properly
  if base_logger.respond_to?(:tagged)
    base_logger
  else
    ActiveSupport::TaggedLogging.new(base_logger)
  end
end