lib/feature_gate.rb in feature_gate-0.0.5 vs lib/feature_gate.rb in feature_gate-0.0.6
- old
+ new
@@ -8,14 +8,31 @@
# Yield self on setup for nice config blocks
def self.setup
yield self
end
+ def self.gate_page(name)
+ gated_feature = GatedFeature.where(name: name).first_or_create
+ if gated_feature.gated?
+ raise ActiveRecord::RecordNotFound
+ end
+ end
+
def self.gate(name)
gated_feature = GatedFeature.where(name: name).first_or_create
if !gated_feature.gated?
yield
end
+ end
+
+ def self.turn_on!(name)
+ gated_feature = GatedFeature.find_by_name!(name)
+ gated_feature.turn_on!
+ end
+
+ def self.turn_off!(name)
+ gated_feature = GatedFeature.find_by_name!(name)
+ gated_feature.turn_on!
end
end
require 'feature_gate/engine'