class WebpackerLite::Env

Public Class Methods

current() click to toggle source
# File lib/webpacker_lite/env.rb, line 6
def current
  raise WebpackerLite::FileLoader::FileLoaderError.new("WebpackerLite::Env.load must be called first") unless instance
  instance.data
end
file_path() click to toggle source
# File lib/webpacker_lite/env.rb, line 18
def file_path
  Rails.root.join("config", "webpacker_lite.yml")
end
hot_loading?() click to toggle source
# File lib/webpacker_lite/env.rb, line 11
def hot_loading?
  (ENV["HOT_RELOADING"].present? && (
  ENV["HOT_RELOADING"].upcase == "YES" ||
    ENV["HOT_RELOADING"].upcase == "TRUE")) ||
    current["hot_reloading_enabled_by_default"]
end

Private Instance Methods

load_data() click to toggle source
# File lib/webpacker_lite/env.rb, line 24
def load_data
  environments = File.exist?(@path) ? YAML.load(File.read(@path)).keys : [].freeze
  return ENV["NODE_ENV"] if environments.include?(ENV["NODE_ENV"])
  return Rails.env if environments.include?(Rails.env)
  "production"
end