lib/flipper/gates/boolean.rb in flipper-0.6.3 vs lib/flipper/gates/boolean.rb in flipper-0.7.0.beta1

- old
+ new

@@ -1,15 +1,8 @@ module Flipper module Gates class Boolean < Gate - TruthMap = { - true => true, - false => false, - 'true' => true, - 'false' => false, - } - # Internal: The name of the gate. Used for instrumentation, etc. def name :boolean end @@ -29,20 +22,18 @@ 'Disabled' end end def enabled?(value) - !!TruthMap[value] + Typecast.to_boolean(value) end # Internal: Checks if the gate is open for a thing. # # Returns true if explicitly set to true, false if explicitly set to false # or nil if not explicitly set. - def open?(thing, value) - instrument(:open?, thing) { |payload| - !!TruthMap[value] - } + def open?(thing, value, options = {}) + value end def protects?(thing) thing.is_a?(Flipper::Types::Boolean) end