File: identifier.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 (17 lines) | stat: -rw-r--r-- 361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Flipper
  # A default implementation of `#flipper_id` for actors.
  #
  #   class User < Struct.new(:id)
  #     include Flipper::Identifier
  #   end
  #
  #   user = User.new(99)
  #   Flipper.enable :thing, user
  #   Flipper.enabled? :thing, user #=> true
  #
  module Identifier
    def flipper_id
      "#{self.class.name};#{id}"
    end
  end
end