features. • add(feature) - Add a feature to the set of known features. • remove(feature) - Remove a feature from the set of known features. • clear(feature) - Clear all gate values for a feature. • get(feature) - Get all gate values for a feature. • enable(feature, gate, thing) - Enable a gate for a thing. • disable(feature, gate, thing) - Disable a gate for a thing. • get_multi(features) - Get all gate values for several features at once.
be a String or Symbol" end @memoized_features[name.to_sym] ||= Feature.new(name, @adapter, instrumenter: instrumenter) end def enable(thing = true) instrument(:enable) do |payload| adapter.add self gate = gate_for(thing) wrapped_thing = gate.wrap(thing) payload[:gate_name] = gate.name payload[:thing] = wrapped_thing adapter.enable self, gate, wrapped_thing end end
users? • use a group gate! Flipper.register(:admins) do |actor| actor.respond_to?(:admin?) && actor.admin? end $flipper[:side_pane].enable_group(:admins)