Class: Audiences::Context

Inherits:
ApplicationRecord show all
Includes:
Locating
Defined in:
app/models/audiences/context.rb,
app/models/audiences/context/locating.rb

Overview

Represents a context where the group of users (audience) is relevant. It includes the current matching users and the criteria to match these users (#criteria, #match_all, #extra_users).

Defined Under Namespace

Modules: Locating

Constant Summary

Constants included from Locating

Locating::SIGNED_GID_RESOURCE

Instance Method Summary collapse

Methods included from Locating

#signed_key

Instance Method Details

#as_jsonObject



38
39
40
41
42
43
44
45
# File 'app/models/audiences/context.rb', line 38

def as_json(...)
  {
    match_all: match_all,
    count: count,
    extra_users: extra_users.instance_exec(&Audiences.default_users_scope),
    criteria: criteria,
  }.as_json(...)
end

#usersObject



32
33
34
# File 'app/models/audiences/context.rb', line 32

def users
  matching_external_users.instance_exec(&Audiences.default_users_scope)
end