Sha256: 14b5ff6b8b8043cbb8223c5393ff2fcf7073cac7de1dae00cb9ffc25192e019f

Contents?: true

Size: 573 Bytes

Versions: 10

Compression:

Stored size: 573 Bytes

Contents

# Simple class for turning a flipper_id into an actor that can be based
# to Flipper::Feature#enabled?.
module Flipper
  class Actor
    attr_reader :flipper_id, :flipper_properties

    def initialize(flipper_id, flipper_properties = {})
      @flipper_id = flipper_id
      @flipper_properties = flipper_properties
    end

    def eql?(other)
      self.class.eql?(other.class) &&
        @flipper_id == other.flipper_id &&
        @flipper_properties == other.flipper_properties
    end
    alias_method :==, :eql?

    def hash
      flipper_id.hash
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/actor.rb
flipper-1.3.1 lib/flipper/actor.rb
flipper-1.3.0 lib/flipper/actor.rb
flipper-1.3.0.pre lib/flipper/actor.rb
flipper-1.2.2 lib/flipper/actor.rb
flipper-1.2.1 lib/flipper/actor.rb
flipper-1.2.0 lib/flipper/actor.rb
flipper-1.1.2 lib/flipper/actor.rb
flipper-1.1.1 lib/flipper/actor.rb
flipper-1.1.0 lib/flipper/actor.rb