lib/super_settings.rb in super_settings-1.0.2 vs lib/super_settings.rb in super_settings-2.0.0
- old
+ new
@@ -1,24 +1,28 @@
# frozen_string_literal: true
+require "json"
+
# These classes are required for the gem to function.
require_relative "super_settings/attributes"
require_relative "super_settings/coerce"
require_relative "super_settings/configuration"
require_relative "super_settings/context"
require_relative "super_settings/local_cache"
require_relative "super_settings/setting"
require_relative "super_settings/storage"
+require_relative "super_settings/time_precision"
# This is the main interface to the access settings.
module SuperSettings
# These classes are autoloaded when they are needed.
autoload :Application, "super_settings/application"
autoload :RestAPI, "super_settings/rest_api"
autoload :RackApplication, "super_settings/rack_application"
autoload :ControllerActions, "super_settings/controller_actions"
autoload :HistoryItem, "super_settings/history_item"
+ autoload :HttpClient, "super_settings/http_client"
autoload :VERSION, "super_settings/version"
DEFAULT_REFRESH_INTERVAL = 5.0
@local_cache = LocalCache.new(refresh_interval: DEFAULT_REFRESH_INTERVAL)
@@ -217,9 +221,16 @@
def configure(&block)
Configuration.instance.defer(&block)
unless defined?(Rails::Engine)
Configuration.instance.call
end
+ end
+
+ # Return the configuration object.
+ #
+ # @return [SuperSettings::Configuration]
+ def configuration
+ Configuration.instance
end
# Set the number of seconds between checks to synchronize the in memory cache from the database.
# This setting aids in performance since it throttles the number of times the database is queried
# for changes. However, changes made to the settings in the databae will take up to the number of