Sha256: abd5177d811ad378b87e6b92e4e48a3dbcd7783cbce548ff865a462cc02e10a5
Contents?: true
Size: 819 Bytes
Versions: 13
Compression:
Stored size: 819 Bytes
Contents
require 'flipper/ui/action' require 'flipper/ui/decorators/feature' module Flipper module UI module Actions class PercentageOfTimeGate < UI::Action include FeatureNameFromRoute route %r{\A/features/(?<feature_name>.*)/percentage_of_time/?\Z} def post read_only if Flipper::UI.configuration.read_only feature = flipper[feature_name] @feature = Decorators::Feature.new(feature) begin feature.enable_percentage_of_time params['value'] rescue ArgumentError => exception error = "Invalid percentage of time value: #{exception.message}" redirect_to("/features/#{@feature.key}?error=#{error}") end redirect_to "/features/#{@feature.key}" end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems