Sha256: 17c3f40377189aca176830fdb439477fbb88219d0b1bc225237c8d30c5def919

Contents?: true

Size: 841 Bytes

Versions: 16

Compression:

Stored size: 841 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 an actor.
      #
      # Returns true if gate open for actor, false if not.
      def open?(context)
        return false unless context.actors?

        context.actors.any? do |actor|
          context.values.actors.include?(actor.value)
        end
      end

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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/gates/actor.rb
flipper-1.3.1 lib/flipper/gates/actor.rb
flipper-1.3.0 lib/flipper/gates/actor.rb
flipper-1.3.0.pre lib/flipper/gates/actor.rb
flipper-1.2.2 lib/flipper/gates/actor.rb
flipper-1.2.1 lib/flipper/gates/actor.rb
flipper-1.2.0 lib/flipper/gates/actor.rb
flipper-1.1.2 lib/flipper/gates/actor.rb
flipper-1.1.1 lib/flipper/gates/actor.rb
flipper-1.1.0 lib/flipper/gates/actor.rb
flipper-1.0.0 lib/flipper/gates/actor.rb
flipper-1.0.0.pre lib/flipper/gates/actor.rb
flipper-0.28.3 lib/flipper/gates/actor.rb
flipper-0.28.2 lib/flipper/gates/actor.rb
flipper-0.28.1 lib/flipper/gates/actor.rb
flipper-0.28.0 lib/flipper/gates/actor.rb