Method: Prisma.group

Defined in:
lib/prisma.rb

.group(name, options = {}, &block) ⇒ Object

Configures a group. The instance of the current ActionController is being passed as an argument into the block. As an example, tracking daily active users could be as simple as:

Prisma.setup do |config|
  config.group :logged_in { |controller| controller.current_user.id }
end

Parameters:

  • name (Symbol/String)

    for identifying the group, it is used as part of the redis key.

  • options (Hash) (defaults to: {})

    where :type is either :counter (default) or :bitmap, and where :description is an optional description (used in the admin UI)

  • block (Block)

    returning a String (or a meaningful .to_s output) which is used for identifying a counter inside a group, Prisma doesn’t count a request if block returns nil or false



65
66
67
# File 'lib/prisma.rb', line 65

def self.group(name, options={}, &block)
  @@groups[name] = Group.new(options.merge(name: name, block: block))
end