Sha256: e8cd727de1016b52cf8df1c90af5f0e5d7d72ad2607583056912b195dd64218e

Contents?: true

Size: 445 Bytes

Versions: 5

Compression:

Stored size: 445 Bytes

Contents

module Flipper
  module Gates
    class Boolean < Gate
      Key = :boolean

      def type_key
        Key
      end

      def toggle_class
        Toggles::Boolean
      end

      def open?(actor)
        value = toggle.value

        if value.nil?
          false
        else
          throw :short_circuit, !!value
        end
      end

      def protects?(thing)
        thing.is_a?(Flipper::Types::Boolean)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flipper-0.3.0 lib/flipper/gates/boolean.rb
flipper-0.2.1 lib/flipper/gates/boolean.rb
flipper-0.2.0 lib/flipper/gates/boolean.rb
flipper-0.1.1 lib/flipper/gates/boolean.rb
flipper-0.1.0 lib/flipper/gates/boolean.rb