Sha256: 9204bce05ae5a075958f9a7a93963ff5d1041a586c4eff30e98c690832e727e4
Contents?: true
Size: 635 Bytes
Versions: 1
Compression:
Stored size: 635 Bytes
Contents
# frozen_string_literal: true module ViteR # Sets the appropriately prefixed ENV variables with VITE_RB class Env ENV_PREFIX = 'VITE_RB' class << self def create_env_variables(config = ViteRb.config) instance_variables.each do |var| value = config.instance_variable_get(var) # .slice removes the "@" from beginning of string var = var.to_s.upcase.slice(1..-1) set_env(var, value) end end private def set_env(env_var, value) return if value.nil? ENV["#{ENV_PREFIX}_#{env_var}"] ||= value.to_s end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vite_rb-0.0.1.alpha1 | lib/vite_rb/env.rb |