Class: FeatureGate::GatedFeature
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- FeatureGate::GatedFeature
- Defined in:
- app/models/feature_gate/gated_feature.rb
Instance Method Summary collapse
Instance Method Details
#deploy_feature! ⇒ Object
12 13 14 15 |
# File 'app/models/feature_gate/gated_feature.rb', line 12 def deploy_feature! self.gated = false save! end |
#destroyable? ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/feature_gate/gated_feature.rb', line 30 def destroyable? regex = /FeatureGate::Manager.gate(\(|\s)('|")#{name}('|")|FeatureGate::Manager.gate_page(\(|\s)('|")#{name}('|")/ files = Dir["#{Dir.pwd}/app/views/**/*.html.erb"] + Dir["#{Dir.pwd}/app/controllers/**/*.rb"] files.each do |file| f = File.new(file) text = f.read return false if text =~ regex end true end |
#gate_feature! ⇒ Object
17 18 19 20 |
# File 'app/models/feature_gate/gated_feature.rb', line 17 def gate_feature! self.gated = true save! end |
#status ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/models/feature_gate/gated_feature.rb', line 22 def status if gated 'closed' else 'opened' end end |