Class: GeminiAI::Utils::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/loader.rb

Overview

Utility class for loading environment variables from .env files

Class Method Summary collapse

Class Method Details

.load(file_path = '.env') ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/utils/loader.rb', line 5

def self.load(file_path = '.env')
  return unless File.exist?(file_path)
  
  File.readlines(file_path).each do |line|
    line = line.strip
    next if line.empty? || line.start_with?('#')
    
    key, value = line.split('=', 2)
    ENV[key] = value if key && value
  end
end