lib/flipper/adapters/redis.rb in flipper-redis-0.10.2 vs lib/flipper/adapters/redis.rb in flipper-redis-0.11.0.beta1

- old
+ new

@@ -66,11 +66,11 @@ # Public: Enables a gate for a given thing. # # feature - The Flipper::Feature for the gate. # gate - The Flipper::Gate to disable. - # thing - The Flipper::Type being disabled for the gate. + # thing - The Flipper::Type being enabled for the gate. # # Returns true. def enable(feature, gate, thing) case gate.data_type when :boolean, :integer @@ -124,18 +124,19 @@ def result_for_feature(feature, doc) result = {} fields = doc.keys feature.gates.each do |gate| - result[gate.key] = case gate.data_type - when :boolean, :integer - doc[gate.key.to_s] - when :set - fields_to_gate_value fields, gate - else - unsupported_data_type gate.data_type - end + result[gate.key] = + case gate.data_type + when :boolean, :integer + doc[gate.key.to_s] + when :set + fields_to_gate_value fields, gate + else + unsupported_data_type gate.data_type + end end result end @@ -146,10 +147,10 @@ # Private: Returns a set of values given an array of fields and a gate. # # Returns a Set of the values enabled for the gate. def fields_to_gate_value(fields, gate) - regex = /^#{Regexp.escape(gate.key.to_s)}\// + regex = %r{^#{Regexp.escape(gate.key.to_s)}/} keys = fields.grep(regex) values = keys.map { |key| key.split('/', 2).last } values.to_set end