module FeatureFlags::FeatureBase
Public Class Methods
features()
click to toggle source
returns features hash
# File lib/feature_flags/feature_base.rb, line 14 def self.features ##checking value in pstore if false then update to true and update features_hash pstore_value = get_pstore_value @@features_hash = {} unless (pstore_value.present? && !defined? Rails::Console) if(@@features_hash.present? && pstore_value.present?) @@features_hash else set_hash Feature.new.update_pstore_hash end @@features_hash end
get_pstore_value()
click to toggle source
returns current value in pstore
# File lib/feature_flags/feature_base.rb, line 30 def self.get_pstore_value store = PStore.new('feature_flags') store.transaction {store[:updated]} end
set_hash()
click to toggle source
updates hash for features
# File lib/feature_flags/feature_base.rb, line 36 def self.set_hash @@features_hash = {} Feature.all.map{|f| @@features_hash[f.name.to_s.intern] = f.status} @@features_hash.freeze end
Public Instance Methods
update_hash()
click to toggle source
# File lib/feature_flags/feature_base.rb, line 42 def update_hash FeatureFlags::FeatureBase.set_hash update_pstore_hash end
update_pstore_hash()
click to toggle source
# File lib/feature_flags/feature_base.rb, line 47 def update_pstore_hash FeatureFlags.update_pstore_value(!defined? Rails::Console) end