Class: Masks::Actors::Anonymous

Inherits:
Masks::ApplicationModel show all
Includes:
Masks::Actor
Defined in:
app/models/masks/actors/anonymous.rb

Overview

An anonymous actor, used for cases where deemed acceptable.

See Also:

Instance Method Summary collapse

Methods included from Masks::Actor

#actor_id, #authenticate, #backup?, #factor2?, #password=, #session=, #session_key, #version

Methods included from Scoped

#role?, #role_records, #roles, #scope?

Instance Method Details

#anonymous?Boolean

Mark this actor as anonymous.

Returns:

  • (Boolean)


35
36
37
# File 'app/models/masks/actors/anonymous.rb', line 35

def anonymous?
  true
end

#mask!Boolean

This is a no-op for anonymous actors. It always returns true.

Returns:

  • (Boolean)


28
29
30
# File 'app/models/masks/actors/anonymous.rb', line 28

def mask!
  true
end

#nicknameString

Generates and returns random nickname for the actor.

Returns:

  • (String)


16
17
18
# File 'app/models/masks/actors/anonymous.rb', line 16

def nickname
  @nickname ||= "anon:#{SecureRandom.hex}"
end

#scopesArray

Returns an empty array, since no scopes are available to anonymous actors.

Returns:

  • (Array)

    an empty array, since no scopes are available to anonymous actors



21
22
23
# File 'app/models/masks/actors/anonymous.rb', line 21

def scopes
  []
end