Sha256: 114b8efc2b0d7cc25a742a432627a4e9057411492cff81a1d3080a8dea84ec5c
Contents?: true
Size: 956 Bytes
Versions: 79
Compression:
Stored size: 956 Bytes
Contents
module TinyMCE::Rails class ConfigurationFile attr_reader :path def initialize(path) @path = path end def configuration @configuration = load_configuration if reload? @configuration end def reload? @configuration.nil? || (reloadable? && changed?) end def changed? @last_loaded != last_updated end private def reloadable? !::Rails.application.config.cache_classes end def last_updated File.exists?(path) && File.mtime(path) end def load_configuration @last_loaded = last_updated return Configuration.new_with_defaults if !File.exists?(path) options = load_yaml(path) if options && options.has_key?('default') MultipleConfiguration.new(options) else Configuration.new_with_defaults(options) end end def load_yaml(path) YAML::load(ERB.new(IO.read(path)).result) end end end
Version data entries
79 entries across 79 versions & 3 rubygems