Sha256: d92081cfd967218848f6d57995d825ce0f907c3b7bb74cc439bcbc3f52e1a4d7
Contents?: true
Size: 899 Bytes
Versions: 29
Compression:
Stored size: 899 Bytes
Contents
module Hyrax::Strategies class YamlStrategy < Flipflop::Strategies::AbstractStrategy class << self def default_description "Features configured by a YAML configuration file." end end def initialize(**options) @config_file = options.delete(:config) yaml_file super(**options) end def switchable? false end def enabled?(feature) return unless key_exists?(feature) yaml_file[feature.to_s]["enabled"] end def switch!(_feature, _enabled); end def clear!(_feature); end private def key_exists?(feature) yaml_file[feature.to_s]&.key?("enabled") end def yaml_file @yaml_file ||= begin if File.exist?(@config_file) YAML.load_file(@config_file) else {} end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems