Sha256: 2daa2472d06020731bba27245ef61bd24e544713fc2c570c78afe33463faccc1
Contents?: true
Size: 867 Bytes
Versions: 14
Compression:
Stored size: 867 Bytes
Contents
# frozen_string_literal: true 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 ||= if File.exist?(@config_file) YAML.load_file(@config_file) else {} end end end end
Version data entries
14 entries across 14 versions & 1 rubygems