File: actor.rb

package info (click to toggle)
ruby-flipper 0.26.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,288 kB
  • sloc: ruby: 16,377; sh: 61; javascript: 24; makefile: 14
file content (20 lines) | stat: -rw-r--r-- 413 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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

    def initialize(flipper_id)
      @flipper_id = flipper_id
    end

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

    def hash
      flipper_id.hash
    end
  end
end