Sha256: 44e13ce38fa62d11d5c497ac90d15900f86a0a0df074163ba3b57e5358663e8e

Contents?: true

Size: 793 Bytes

Versions: 4

Compression:

Stored size: 793 Bytes

Contents

module Flipper
  module Gates
    class Actor < Gate
      # Internal: The name of the gate. Used for instrumentation, etc.
      def name
        :actor
      end

      # Internal: Name converted to value safe for adapter.
      def key
        :actors
      end

      def data_type
        :set
      end

      def enabled?(value)
        !value.empty?
      end

      # Internal: Checks if the gate is open for a thing.
      #
      # Returns true if gate open for thing, false if not.
      def open?(context)
        return false if context.thing.nil?
        context.values.actors.include?(context.thing.value)
      end

      def wrap(thing)
        Types::Actor.wrap(thing)
      end

      def protects?(thing)
        Types::Actor.wrappable?(thing)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flipper-0.27.1 lib/flipper/gates/actor.rb
flipper-0.27.0 lib/flipper/gates/actor.rb
flipper-0.26.2 lib/flipper/gates/actor.rb
flipper-0.26.1 lib/flipper/gates/actor.rb